summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index 635616c..9f14222 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -1032,20 +1032,7 @@ _PyInterpreterState_SetRunningMain(PyInterpreterState *interp)
void
_PyInterpreterState_SetNotRunningMain(PyInterpreterState *interp)
{
- PyThreadState *tstate = interp->threads.main;
- assert(tstate == current_fast_get());
-
- if (tstate->on_delete != NULL) {
- // The threading module was imported for the first time in this
- // thread, so it was set as threading._main_thread. (See gh-75698.)
- // The thread has finished running the Python program so we mark
- // the thread object as finished.
- assert(tstate->_whence != _PyThreadState_WHENCE_THREADING);
- tstate->on_delete(tstate->on_delete_data);
- tstate->on_delete = NULL;
- tstate->on_delete_data = NULL;
- }
-
+ assert(interp->threads.main == current_fast_get());
interp->threads.main = NULL;
}
@@ -1570,16 +1557,6 @@ PyThreadState_Clear(PyThreadState *tstate)
Py_CLEAR(tstate->context);
- if (tstate->on_delete != NULL) {
- // For the "main" thread of each interpreter, this is meant
- // to be done in _PyInterpreterState_SetNotRunningMain().
- // That leaves threads created by the threading module,
- // and any threads killed by forking.
- // However, we also accommodate "main" threads that still
- // don't call _PyInterpreterState_SetNotRunningMain() yet.
- tstate->on_delete(tstate->on_delete_data);
- }
-
#ifdef Py_GIL_DISABLED
// Each thread should clear own freelists in free-threading builds.
struct _Py_object_freelists *freelists = _Py_object_freelists_GET();