From: Victor Stinner Date: Mon, 20 Jun 2011 13:01:10 +0000 (+0200) Subject: find_module_path_list() fails if _Py_fopen() failed and raised an exception X-Git-Tag: v3.3.0a1~2082 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=925ef39949b784d331dbb246b8888347ecd8b275;p=python find_module_path_list() fails if _Py_fopen() failed and raised an exception (UnicodeEncodeError). --- diff --git a/Python/import.c b/Python/import.c index 9ec8cd8b84..de5dc0ca41 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);