summaryrefslogtreecommitdiff
path: root/Modules/_fileio.c
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2009-02-10 13:32:24 +0000
committerKristján Valur Jónsson <kristjan@ccpgames.com>2009-02-10 13:32:24 +0000
commit6a743d3694fb5138f5eab393c172c3b6789b0383 (patch)
treebf47b632ad93844f4d50d35df88c38b70ee731f9 /Modules/_fileio.c
parente71fc8711289a2f748f6dd207d3953622a30abf7 (diff)
downloadcpython-git-6a743d3694fb5138f5eab393c172c3b6789b0383.tar.gz
Issue 4804. Add a function to test the validity of file descriptors on Windows, and stop using global runtime settings to silence the warnings / assertions.
Diffstat (limited to 'Modules/_fileio.c')
-rw-r--r--Modules/_fileio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/_fileio.c b/Modules/_fileio.c
index 2fc6de887a..409abf6e0f 100644
--- a/Modules/_fileio.c
+++ b/Modules/_fileio.c
@@ -127,7 +127,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)",