summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-05-15 19:59:26 (GMT)
committerGitHub <noreply@github.com>2023-05-15 19:59:26 (GMT)
commit26baa747c2ebc2beeff769bb07b5fb5a51ad5f4b (patch)
treee54b52c2c950d59a20f4b0658d8eb2af3adec246 /Python/pystate.c
parentcb88ae635e96d7020ba6187bcfd45ace4dcd8395 (diff)
downloadcpython-26baa747c2ebc2beeff769bb07b5fb5a51ad5f4b.zip
cpython-26baa747c2ebc2beeff769bb07b5fb5a51ad5f4b.tar.gz
cpython-26baa747c2ebc2beeff769bb07b5fb5a51ad5f4b.tar.bz2
gh-104341: Adjust tstate_must_exit() to Respect Interpreter Finalization (gh-104437)
With the move to a per-interpreter GIL, this check slipped through the cracks.
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index 26debf1..25e655a 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -1436,11 +1436,13 @@ PyThreadState_Clear(PyThreadState *tstate)
if (verbose && tstate->cframe->current_frame != NULL) {
/* bpo-20526: After the main thread calls
- _PyRuntimeState_SetFinalizing() in Py_FinalizeEx(), threads must
- exit when trying to take the GIL. If a thread exit in the middle of
- _PyEval_EvalFrameDefault(), tstate->frame is not reset to its
- previous value. It is more likely with daemon threads, but it can
- happen with regular threads if threading._shutdown() fails
+ _PyInterpreterState_SetFinalizing() in Py_FinalizeEx()
+ (or in Py_EndInterpreter() for subinterpreters),
+ threads must exit when trying to take the GIL.
+ If a thread exit in the middle of _PyEval_EvalFrameDefault(),
+ tstate->frame is not reset to its previous value.
+ It is more likely with daemon threads, but it can happen
+ with regular threads if threading._shutdown() fails
(ex: interrupted by CTRL+C). */
fprintf(stderr,
"PyThreadState_Clear: warning: thread still has a frame\n");