diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2023-06-14 00:50:08 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-14 00:50:08 (GMT) |
commit | 33d3069c45bda38f52053a115e3c0810cd631dd6 (patch) | |
tree | ee49a043f3960473e891ce9a1a4be3abee2a878c /Python/pylifecycle.c | |
parent | 75239d5ec1505b8f9f20d3c2d366c1a3ebd269aa (diff) | |
download | cpython-33d3069c45bda38f52053a115e3c0810cd631dd6.zip cpython-33d3069c45bda38f52053a115e3c0810cd631dd6.tar.gz cpython-33d3069c45bda38f52053a115e3c0810cd631dd6.tar.bz2 |
[3.12] gh-104812: Run Pending Calls in any Thread (gh-104813) (gh-105752)
For a while now, pending calls only run in the main thread (in the main interpreter). This PR changes things to allow any thread run a pending call, unless the pending call was explicitly added for the main thread to run.
(cherry picked from commit 757b402)
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r-- | Python/pylifecycle.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index c4e6b69..a67fa26 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -2152,6 +2152,9 @@ Py_EndInterpreter(PyThreadState *tstate) // Wrap up existing "threading"-module-created, non-daemon threads. wait_for_thread_shutdown(tstate); + // Make any remaining pending calls. + _Py_FinishPendingCalls(tstate); + _PyAtExit_Call(tstate->interp); if (tstate != interp->threads.head || tstate->next != NULL) { |