summaryrefslogtreecommitdiff
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2019-04-12 09:18:16 -0600
committerGitHub <noreply@github.com>2019-04-12 09:18:16 -0600
commitf13c5c8b9401a9dc19e95d8b420ee100ac022208 (patch)
tree00e61cfbb38d11341b39c3d5abe6b04a2ccbbbb5 /Python/pylifecycle.c
parent44235041f3b957abd36d3792450c3540aa09e120 (diff)
downloadcpython-git-f13c5c8b9401a9dc19e95d8b420ee100ac022208.tar.gz
bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). (gh-12360)
This is effectively an un-revert of #11617 and #12024 (reverted in #12159). Portions of those were merged in other PRs (with lower risk) and this represents the remainder. Note that I found 3 different bugs in the original PRs and have fixed them here.
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index ad1447256c..44acba2d93 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -1146,7 +1146,7 @@ Py_FinalizeEx(void)
interp = tstate->interp;
// Make any remaining pending calls.
- _Py_FinishPendingCalls();
+ _Py_FinishPendingCalls(interp);
/* The interpreter is still entirely intact at this point, and the
* exit funcs may be relying on that. In particular, if some thread
@@ -1552,6 +1552,9 @@ Py_EndInterpreter(PyThreadState *tstate)
// Wrap up existing "threading"-module-created, non-daemon threads.
wait_for_thread_shutdown();
+ // Make any remaining pending calls.
+ _Py_FinishPendingCalls(interp);
+
call_py_exitfuncs(interp);
if (tstate != interp->tstate_head || tstate->next != NULL)