mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
bpo-38858: Add _Py_IsMainInterpreter(tstate) (GH-17293)
This commit is contained in:
parent
db7925a1ca
commit
fff7bbfdb6
3 changed files with 11 additions and 3 deletions
|
@ -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[] = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue