diff options
author | Steve Dower <steve.dower@microsoft.com> | 2015-04-12 04:26:27 (GMT) |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2015-04-12 04:26:27 (GMT) |
commit | 8fc8980c96f58a7f06e4e3133735807bd245c658 (patch) | |
tree | 04376ea1928a20c88b506e836ab82cc266cc85ae /Modules/_io | |
parent | fe0a41aae425c61364b79c18ca8321dffed3ac40 (diff) | |
download | cpython-8fc8980c96f58a7f06e4e3133735807bd245c658.zip cpython-8fc8980c96f58a7f06e4e3133735807bd245c658.tar.gz cpython-8fc8980c96f58a7f06e4e3133735807bd245c658.tar.bz2 |
Issue #23524: Replace _PyVerify_fd function with calls to _set_thread_local_invalid_parameter_handler.
Diffstat (limited to 'Modules/_io')
-rw-r--r-- | Modules/_io/fileio.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c index bb3e9b9..186319b 100644 --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -107,9 +107,11 @@ internal_close(fileio *self) /* fd is accessible and someone else may have closed it */ if (_PyVerify_fd(fd)) { Py_BEGIN_ALLOW_THREADS + _Py_BEGIN_SUPPRESS_IPH err = close(fd); if (err < 0) save_errno = errno; + _Py_END_SUPPRESS_IPH Py_END_ALLOW_THREADS } else { save_errno = errno; @@ -599,11 +601,14 @@ fileio_readall(fileio *self) if (!_PyVerify_fd(self->fd)) return PyErr_SetFromErrno(PyExc_IOError); + _Py_BEGIN_SUPPRESS_IPH #ifdef MS_WINDOWS pos = _lseeki64(self->fd, 0L, SEEK_CUR); #else pos = lseek(self->fd, 0L, SEEK_CUR); #endif + _Py_END_SUPPRESS_IPH + if (_Py_fstat_noraise(self->fd, &status) == 0) end = status.st_size; else @@ -792,11 +797,13 @@ portable_lseek(int fd, PyObject *posobj, int whence) if (_PyVerify_fd(fd)) { Py_BEGIN_ALLOW_THREADS + _Py_BEGIN_SUPPRESS_IPH #ifdef MS_WINDOWS res = _lseeki64(fd, pos, whence); #else res = lseek(fd, pos, whence); #endif + _Py_END_SUPPRESS_IPH Py_END_ALLOW_THREADS } else res = -1; @@ -951,7 +958,12 @@ fileio_isatty(fileio *self) if (self->fd < 0) return err_closed(); Py_BEGIN_ALLOW_THREADS - res = isatty(self->fd); + _Py_BEGIN_SUPPRESS_IPH + if (_PyVerify_fd(self->fd)) + res = isatty(self->fd); + else + res = 0; + _Py_END_SUPPRESS_IPH Py_END_ALLOW_THREADS return PyBool_FromLong(res); } |