summaryrefslogtreecommitdiffstats
path: root/Python/crossinterp.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2024-06-25 20:35:12 (GMT)
committerGitHub <noreply@github.com>2024-06-25 20:35:12 (GMT)
commita905721b9c5c15279e67c2f7785034b7356b2d46 (patch)
tree128afaafee27cac1e55fe22e552a2e41ac8921ef /Python/crossinterp.c
parent769aea332940f03c3e5b1ad9badd6635c1ac992a (diff)
downloadcpython-a905721b9c5c15279e67c2f7785034b7356b2d46.zip
cpython-a905721b9c5c15279e67c2f7785034b7356b2d46.tar.gz
cpython-a905721b9c5c15279e67c2f7785034b7356b2d46.tar.bz2
gh-120838: Add _PyThreadState_WHENCE_FINI (gh-121010)
We also add _PyThreadState_NewBound() and drop _PyThreadState_SetWhence(). This change only affects internal API.
Diffstat (limited to 'Python/crossinterp.c')
-rw-r--r--Python/crossinterp.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Python/crossinterp.c b/Python/crossinterp.c
index 367e29d..a03456a 100644
--- a/Python/crossinterp.c
+++ b/Python/crossinterp.c
@@ -1544,8 +1544,7 @@ _enter_session(_PyXI_session *session, PyInterpreterState *interp)
PyThreadState *tstate = PyThreadState_Get();
PyThreadState *prev = tstate;
if (interp != tstate->interp) {
- tstate = PyThreadState_New(interp);
- _PyThreadState_SetWhence(tstate, _PyThreadState_WHENCE_EXEC);
+ tstate = _PyThreadState_NewBound(interp, _PyThreadState_WHENCE_EXEC);
// XXX Possible GILState issues?
session->prev_tstate = PyThreadState_Swap(tstate);
assert(session->prev_tstate == prev);
@@ -1895,8 +1894,7 @@ _PyXI_EndInterpreter(PyInterpreterState *interp,
tstate = cur_tstate;
}
else {
- tstate = PyThreadState_New(interp);
- _PyThreadState_SetWhence(tstate, _PyThreadState_WHENCE_INTERP);
+ tstate = _PyThreadState_NewBound(interp, _PyThreadState_WHENCE_FINI);
assert(tstate != NULL);
save_tstate = PyThreadState_Swap(tstate);
}