Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 72456:0f5b64630fda 2.7
Issue #7732: Fix a crash on importing a module if a directory has the same name
than a Python module (e.g. "__init__.py"): don't close the file twice.
PyFile_FromFile() does also close the file if PyString_FromString() failed. It
did already close the file on fill_file_fields() error (e.g. if the file is a
directory).
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Fri, 23 Sep 2011 19:37:03 +0200 |
| parents | c9bb16b7d148 |
| children | 0499eed74126 |
line wrap: on
line diff
--- a/Python/import.c Fri Sep 23 01:15:32 2011 +0200 +++ b/Python/import.c Fri Sep 23 19:37:03 2011 +0200 @@ -2845,10 +2845,8 @@ return NULL; if (fp != NULL) { fob = PyFile_FromFile(fp, pathname, fdp->mode, fclose); - if (fob == NULL) { - fclose(fp); + if (fob == NULL) return NULL; - } } else { fob = Py_None;
