summaryrefslogtreecommitdiff
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 2975b3ebd6..73114df79c 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -1226,9 +1226,6 @@ finalize_interp_delete(PyThreadState *tstate, int is_main_interp)
_PyGILState_Fini(tstate);
}
- /* Delete current thread. After this, many C API calls become crashy. */
- PyThreadState_Swap(NULL);
-
PyInterpreterState_Delete(tstate->interp);
}
@@ -1577,9 +1574,9 @@ handle_error:
PyErr_PrintEx(0);
PyThreadState_Clear(tstate);
- PyThreadState_Swap(save_tstate);
PyThreadState_Delete(tstate);
PyInterpreterState_Delete(interp);
+ PyThreadState_Swap(save_tstate);
*tstate_p = NULL;
return _PyStatus_OK();