aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-05-04 16:21:01 +0200
committerGitHub <noreply@github.com>2023-05-04 16:21:01 +0200
commit45398ad51220b63b8df08fb5551c6b736205daed (patch)
tree42d5b05c0706b871067d7390768493878d07eda9 /Python/pylifecycle.c
parenteba64d2afb4c429e80d863dc0dd7808bdbef30d3 (diff)
downloadcpython-45398ad51220b63b8df08fb5551c6b736205daed.tar.gz
cpython-45398ad51220b63b8df08fb5551c6b736205daed.zip
gh-103323: Remove PyRuntimeState_GetThreadState() (#104171)
This function no longer makes sense, since its runtime parameter is no longer used. Use directly _PyThreadState_GET() and _PyInterpreterState_GET() instead.
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index b9add89b9c6..97957d3f17e 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -1303,8 +1303,7 @@ _Py_InitializeMain(void)
if (_PyStatus_EXCEPTION(status)) {
return status;
}
- _PyRuntimeState *runtime = &_PyRuntime;
- PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime);
+ PyThreadState *tstate = _PyThreadState_GET();
return pyinit_main(tstate);
}
@@ -1755,7 +1754,7 @@ Py_FinalizeEx(void)
}
/* Get current thread state and interpreter pointer */
- PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime);
+ PyThreadState *tstate = _PyThreadState_GET();
// XXX assert(_Py_IsMainInterpreter(tstate->interp));
// XXX assert(_Py_IsMainThread());
@@ -2800,7 +2799,7 @@ fatal_error(int fd, int header, const char *prefix, const char *msg,
tss_tstate != tstate if the current Python thread does not hold the GIL.
*/
- PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime);
+ PyThreadState *tstate = _PyThreadState_GET();
PyInterpreterState *interp = NULL;
PyThreadState *tss_tstate = PyGILState_GetThisThreadState();
if (tstate != NULL) {