summaryrefslogtreecommitdiff
path: root/Python/import.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c
index 9838c3fa04..8bf044827c 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -568,8 +568,6 @@ _PyImport_Cleanup(PyThreadState *tstate)
_PyErr_Clear(tstate);
}
Py_XDECREF(dict);
- /* Clear module dict copies stored in the interpreter state */
- _PyInterpreterState_ClearModules(interp);
/* Collect references */
_PyGC_CollectNoFail();
/* Dump GC stats before it's too late, since it uses the warnings
@@ -621,6 +619,9 @@ _PyImport_Cleanup(PyThreadState *tstate)
}
_PyModule_ClearDict(interp->builtins);
+ /* Clear module dict copies stored in the interpreter state */
+ _PyInterpreterState_ClearModules(interp);
+
/* Clear and delete the modules directory. Actual modules will
still be there only if imported during the execution of some
destructor. */