gh-142737: Handle lost io.open in _Py_FindSourceFile (GH-142747)

This commit is contained in:
Bartosz Sławecki 2025-12-15 23:58:50 +01:00 committed by GitHub
parent 790a46a449
commit f277781bba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 35 additions and 1 deletions

View file

@ -415,6 +415,9 @@ _Py_FindSourceFile(PyObject *filename, char* namebuf, size_t namelen, PyObject *
npath = PyList_Size(syspath);
open = PyObject_GetAttr(io, &_Py_ID(open));
if (open == NULL) {
goto error;
}
for (i = 0; i < npath; i++) {
v = PyList_GetItem(syspath, i);
if (v == NULL) {