diff options
Diffstat (limited to 'Modules/_fileio.c')
-rw-r--r-- | Modules/_fileio.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_fileio.c b/Modules/_fileio.c index 339a1d7..1ed6417 100644 --- a/Modules/_fileio.c +++ b/Modules/_fileio.c @@ -146,7 +146,7 @@ check_fd(int fd) { #if defined(HAVE_FSTAT) struct stat buf; - if (fstat(fd, &buf) < 0 && errno == EBADF) { + if (!_PyVerify_fd(fd) || (fstat(fd, &buf) < 0 && errno == EBADF)) { PyObject *exc; char *msg = strerror(EBADF); exc = PyObject_CallFunction(PyExc_OSError, "(is)", |