diff options
author | Victor Stinner <vstinner@python.org> | 2019-11-20 16:34:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-20 16:34:39 (GMT) |
commit | fff7bbfdb6b7c143b73b6b4b6b40e828c101110c (patch) | |
tree | 36493fb3f956d9c5867b7312a0916c38956d0e13 /Modules/_threadmodule.c | |
parent | db7925a1cac361ad8c94123a38b00b70f306c48d (diff) | |
download | cpython-fff7bbfdb6b7c143b73b6b4b6b40e828c101110c.zip cpython-fff7bbfdb6b7c143b73b6b4b6b40e828c101110c.tar.gz cpython-fff7bbfdb6b7c143b73b6b4b6b40e828c101110c.tar.bz2 |
bpo-38858: Add _Py_IsMainInterpreter(tstate) (GH-17293)
Diffstat (limited to 'Modules/_threadmodule.c')
-rw-r--r-- | Modules/_threadmodule.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index befd213..4a651ce 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -1466,9 +1466,9 @@ static PyObject * _thread__is_main_interpreter_impl(PyObject *module) /*[clinic end generated code: output=7dd82e1728339adc input=cc1eb00fd4598915]*/ { - _PyRuntimeState *runtime = &_PyRuntime; - PyInterpreterState *interp = _PyRuntimeState_GetThreadState(runtime)->interp; - return PyBool_FromLong(interp == runtime->interpreters.main); + PyThreadState *tstate = _PyThreadState_GET(); + int is_main = _Py_IsMainInterpreter(tstate); + return PyBool_FromLong(is_main); } static PyMethodDef thread_methods[] = { |