diff Python/import.c @ 70900:7731d2ab4fd4

find_module_path_list() fails if _Py_fopen() failed and raised an exception (UnicodeEncodeError).
author Victor Stinner <victor.stinner@haypocalc.com>
date Mon, 20 Jun 2011 15:01:10 +0200
parents 9a6d9ac6fb2e
children b4a7cd376d6f
line wrap: on
line diff
--- a/Python/import.c	Mon Jun 20 14:59:53 2011 +0200
+++ b/Python/import.c	Mon Jun 20 15:01:10 2011 +0200
@@ -1908,6 +1908,10 @@
             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);