summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c3
-rw-r--r--Python/pylifecycle.c4
2 files changed, 3 insertions, 4 deletions
diff --git a/Python/import.c b/Python/import.c
index 5606d3bea4..dc0d5b8b90 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -413,9 +413,8 @@ static const char * const sys_files[] = {
/* Un-initialize things, as good as we can */
void
-PyImport_Cleanup(void)
+_PyImport_Cleanup(PyThreadState *tstate)
{
- PyThreadState *tstate = _PyThreadState_GET();
PyInterpreterState *interp = tstate->interp;
PyObject *modules = interp->modules;
if (modules == NULL) {
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 4a97295102..c0b3450789 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -1225,7 +1225,7 @@ Py_FinalizeEx(void)
_PySys_ClearAuditHooks();
/* Destroy all modules */
- PyImport_Cleanup();
+ _PyImport_Cleanup(tstate);
/* Print debug stats if any */
_PyEval_Fini();
@@ -1589,7 +1589,7 @@ Py_EndInterpreter(PyThreadState *tstate)
if (tstate != interp->tstate_head || tstate->next != NULL)
Py_FatalError("Py_EndInterpreter: not the last thread");
- PyImport_Cleanup();
+ _PyImport_Cleanup(tstate);
PyInterpreterState_Clear(interp);
PyThreadState_Swap(NULL);
PyInterpreterState_Delete(interp);