summaryrefslogtreecommitdiffstats
path: root/Modules/_io/fileio.c
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2016-09-08 18:21:54 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2016-09-08 18:21:54 (GMT)
commit940f33a50f3877cbde7adb59ba6e1a0a0acd3d11 (patch)
tree7a326f041f1187cdbd6622e7eb97ceb2af6c0d44 /Modules/_io/fileio.c
parentdee6e252cc59c3143786f3e4cfaa1a6c335381b6 (diff)
downloadcpython-940f33a50f3877cbde7adb59ba6e1a0a0acd3d11.zip
cpython-940f33a50f3877cbde7adb59ba6e1a0a0acd3d11.tar.gz
cpython-940f33a50f3877cbde7adb59ba6e1a0a0acd3d11.tar.bz2
Issue #23524: Finish removing _PyVerify_fd from sources
Diffstat (limited to 'Modules/_io/fileio.c')
-rw-r--r--Modules/_io/fileio.c39
1 files changed, 13 insertions, 26 deletions
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
index 12e5156..54cfb7f 100644
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -117,18 +117,13 @@ internal_close(fileio *self)
int fd = self->fd;
self->fd = -1;
/* 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 {
+ Py_BEGIN_ALLOW_THREADS
+ _Py_BEGIN_SUPPRESS_IPH
+ err = close(fd);
+ if (err < 0)
save_errno = errno;
- err = -1;
- }
+ _Py_END_SUPPRESS_IPH
+ Py_END_ALLOW_THREADS
}
if (err < 0) {
errno = save_errno;
@@ -700,8 +695,6 @@ _io_FileIO_readall_impl(fileio *self)
if (self->fd < 0)
return err_closed();
- if (!_PyVerify_fd(self->fd))
- return PyErr_SetFromErrno(PyExc_IOError);
_Py_BEGIN_SUPPRESS_IPH
#ifdef MS_WINDOWS
@@ -914,18 +907,15 @@ portable_lseek(int fd, PyObject *posobj, int whence)
return NULL;
}
- if (_PyVerify_fd(fd)) {
- Py_BEGIN_ALLOW_THREADS
- _Py_BEGIN_SUPPRESS_IPH
+ Py_BEGIN_ALLOW_THREADS
+ _Py_BEGIN_SUPPRESS_IPH
#ifdef MS_WINDOWS
- res = _lseeki64(fd, pos, whence);
+ res = _lseeki64(fd, pos, whence);
#else
- res = lseek(fd, pos, whence);
+ res = lseek(fd, pos, whence);
#endif
- _Py_END_SUPPRESS_IPH
- Py_END_ALLOW_THREADS
- } else
- res = -1;
+ _Py_END_SUPPRESS_IPH
+ Py_END_ALLOW_THREADS
if (res < 0)
return PyErr_SetFromErrno(PyExc_IOError);
@@ -1116,10 +1106,7 @@ _io_FileIO_isatty_impl(fileio *self)
return err_closed();
Py_BEGIN_ALLOW_THREADS
_Py_BEGIN_SUPPRESS_IPH
- if (_PyVerify_fd(self->fd))
- res = isatty(self->fd);
- else
- res = 0;
+ res = isatty(self->fd);
_Py_END_SUPPRESS_IPH
Py_END_ALLOW_THREADS
return PyBool_FromLong(res);