Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 925ef39

Browse files
author
Victor Stinner
committed
find_module_path_list() fails if _Py_fopen() failed and raised an exception
(UnicodeEncodeError).
1 parent 7edb5df commit 925ef39

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Python/import.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,6 +1908,10 @@ find_module_path_list(PyObject *fullname, PyObject *name,
19081908
fp = _Py_fopen(filename, filemode);
19091909
if (fp == NULL) {
19101910
Py_DECREF(filename);
1911+
if (PyErr_Occurred()) {
1912+
Py_DECREF(prefix);
1913+
return NULL;
1914+
}
19111915
continue;
19121916
}
19131917
match = case_ok(filename, -(Py_ssize_t)strlen(fdp->suffix), name);

0 commit comments

Comments
 (0)