diff --git a/Python/import.c b/Python/import.c index cc7417ba84e..dc79685abd4 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1735,6 +1735,7 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, } } else { + Py_XDECREF(mod); mod = import_find_and_load(abs_name); if (mod == NULL) { goto error;