diff --git a/Python/import.c b/Python/import.c index c20c55727d2f94..22e9ba36390e7b 100644 --- a/Python/import.c +++ b/Python/import.c @@ -4501,6 +4501,9 @@ _PyImport_LazyImportModuleLevelObject(PyThreadState *tstate, assert(!PyErr_Occurred()); modname = Py_NewRef(Py_None); } + if (fromlist == NULL) { + fromlist = Py_NewRef(Py_None); + } PyObject *args[] = {modname, name, fromlist}; PyObject *res = PyObject_Vectorcall(filter, args, 3, NULL);