[Python-checkins] cpython: call_find_module() handles dup() failure: raise an OSError exception

victor.stinner python-checkins at python.org
Mon Jun 20 16:14:54 CEST 2011


http://hg.python.org/cpython/rev/b4a7cd376d6f
changeset:   70901:b4a7cd376d6f
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Mon Jun 20 15:16:55 2011 +0200
summary:
  call_find_module() handles dup() failure: raise an OSError exception

files:
  Python/import.c |  4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Python/import.c b/Python/import.c
--- a/Python/import.c
+++ b/Python/import.c
@@ -3567,6 +3567,10 @@
         if (fd != -1)
             fd = dup(fd);
         fclose(fp);
+        if (fd == -1) {
+            PyErr_SetFromErrno(PyExc_OSError);
+            return NULL;
+        }
         fp = NULL;
     }
     if (fd != -1) {

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list