Re-enable eagerly returning imported module

This commit is contained in:
Dino Viehland 2025-09-29 12:43:43 -07:00
parent 9be59ecebd
commit b179da2cf5

View file

@ -4256,10 +4256,9 @@ _PyImport_LazyImportModuleLevelObject(PyThreadState *tstate,
PyObject *mod = PyImport_GetModule(abs_name);
bool already_exists = mod != NULL;
Py_XDECREF(mod);
//if (mod != NULL) {
// Py_DECREF(abs_name);
// return mod;
//}
if (mod != NULL) {
return PyImport_ImportModuleLevelObject(name, globals, locals, fromlist, level);
}
// Check if the filter disables the lazy import
PyObject *filter = LAZY_IMPORTS_FILTER(interp);