diff options
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r-- | Python/pylifecycle.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 7b80d01..8d744c7 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -55,7 +55,6 @@ static PyStatus add_main_module(PyInterpreterState *interp); static PyStatus init_import_site(void); static PyStatus init_set_builtins_open(void); static PyStatus init_sys_streams(PyThreadState *tstate); -static void call_py_exitfuncs(PyThreadState *tstate); static void wait_for_thread_shutdown(PyThreadState *tstate); static void call_ll_exitfuncs(_PyRuntimeState *runtime); @@ -690,6 +689,12 @@ pycore_init_types(PyThreadState *tstate) if (_PyWarnings_InitState(tstate) < 0) { return _PyStatus_ERR("can't initialize warnings"); } + + status = _PyAtExit_Init(tstate); + if (_PyStatus_EXCEPTION(status)) { + return status; + } + return _PyStatus_OK(); } @@ -1655,7 +1660,7 @@ Py_FinalizeEx(void) * the threads created via Threading. */ - call_py_exitfuncs(tstate); + _PyAtExit_Call(tstate); /* Copy the core config, PyInterpreterState_Delete() free the core config memory */ @@ -1946,7 +1951,7 @@ Py_EndInterpreter(PyThreadState *tstate) // Wrap up existing "threading"-module-created, non-daemon threads. wait_for_thread_shutdown(tstate); - call_py_exitfuncs(tstate); + _PyAtExit_Call(tstate); if (tstate != interp->tstate_head || tstate->next != NULL) { Py_FatalError("not the last thread"); @@ -2633,15 +2638,6 @@ Py_ExitStatusException(PyStatus status) } -/* Clean up and exit */ - -static void -call_py_exitfuncs(PyThreadState *tstate) -{ - _PyAtExit_Call(tstate->interp->atexit_module); -} - - /* Wait until threading._shutdown completes, provided the threading module was imported in the first place. The shutdown routine will wait until all non-daemon |