summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/lock.c24
-rw-r--r--Python/pystate.c25
2 files changed, 1 insertions, 48 deletions
diff --git a/Python/lock.c b/Python/lock.c
index de25adc..7d1ead5 100644
--- a/Python/lock.c
+++ b/Python/lock.c
@@ -304,30 +304,6 @@ PyEvent_WaitTimed(PyEvent *evt, PyTime_t timeout_ns)
}
}
-_PyEventRc *
-_PyEventRc_New(void)
-{
- _PyEventRc *erc = (_PyEventRc *)PyMem_RawCalloc(1, sizeof(_PyEventRc));
- if (erc != NULL) {
- erc->refcount = 1;
- }
- return erc;
-}
-
-void
-_PyEventRc_Incref(_PyEventRc *erc)
-{
- _Py_atomic_add_ssize(&erc->refcount, 1);
-}
-
-void
-_PyEventRc_Decref(_PyEventRc *erc)
-{
- if (_Py_atomic_add_ssize(&erc->refcount, -1) == 1) {
- PyMem_RawFree(erc);
- }
-}
-
static int
unlock_once(_PyOnceFlag *o, int res)
{
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();