find_module_path_list() fails if _Py_fopen() failed and raised an exception

(UnicodeEncodeError).
This commit is contained in:
Victor Stinner 2011-06-20 15:01:10 +02:00
parent 7edb5dfcbc
commit 925ef39949

View 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);