gh-144851: Fix __lazy_import__ crash with user-defined filters (#144852)

This commit is contained in:
Bartosz Sławecki 2026-03-02 12:01:32 +01:00 committed by GitHub
parent 3b276f3f59
commit 8bcb3eaa67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View file

@ -4512,6 +4512,10 @@ _PyImport_LazyImportModuleLevelObject(PyThreadState *tstate,
assert(!PyErr_Occurred());
modname = Py_NewRef(Py_None);
}
if (fromlist == NULL) {
assert(!PyErr_Occurred());
fromlist = Py_NewRef(Py_None);
}
PyObject *args[] = {modname, name, fromlist};
PyObject *res = PyObject_Vectorcall(filter, args, 3, NULL);