diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2023-06-13 15:02:19 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-13 15:02:19 -0600 |
commit | 757b402ea1c2c6b925a55a08fd844b065b6e082f (patch) | |
tree | cf4f2ea1aff52a2c7faa7181f3f9af01f732830f /Python/pylifecycle.c | |
parent | 4e80082723b768df124f77d2b73b3ba6b584a735 (diff) | |
download | cpython-757b402ea1c2c6b925a55a08fd844b065b6e082f.tar.gz cpython-757b402ea1c2c6b925a55a08fd844b065b6e082f.zip |
gh-104812: Run Pending Calls in any Thread (gh-104813)
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.
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 9ae03d4d783..d45b739c279 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) { |