]> granicus.if.org Git - python/commitdiff
find_module_path_list() fails if _Py_fopen() failed and raised an exception
authorVictor Stinner <victor.stinner@haypocalc.com>
Mon, 20 Jun 2011 13:01:10 +0000 (15:01 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Mon, 20 Jun 2011 13:01:10 +0000 (15:01 +0200)
(UnicodeEncodeError).

Python/import.c

index 9ec8cd8b844d9bcb4d80220ccd86a9ef028df4e4..de5dc0ca41a924201f5810b37b43925de27cec18 100644 (file)
@@ -1908,6 +1908,10 @@ find_module_path_list(PyObject *fullname, PyObject *name,
             fp = _Py_fopen(filename, filemode);
             if (fp == NULL) {
                 Py_DECREF(filename);
+                if (PyErr_Occurred()) {
+                    Py_DECREF(prefix);
+                    return NULL;
+                }
                 continue;
             }
             match = case_ok(filename, -(Py_ssize_t)strlen(fdp->suffix), name);