summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-06-20 13:01:10 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-06-20 13:01:10 (GMT)
commit925ef39949b784d331dbb246b8888347ecd8b275 (patch)
treed0851a1a09d7dacf5baf7abcbec0b192a3d98937
parent7edb5dfcbc815e2479e4c68051bf1805d1c9348d (diff)
downloadcpython-925ef39949b784d331dbb246b8888347ecd8b275.zip
cpython-925ef39949b784d331dbb246b8888347ecd8b275.tar.gz
cpython-925ef39949b784d331dbb246b8888347ecd8b275.tar.bz2
find_module_path_list() fails if _Py_fopen() failed and raised an exception
(UnicodeEncodeError).
-rw-r--r--Python/import.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c
index 9ec8cd8..de5dc0c 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -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);