summaryrefslogtreecommitdiffstats
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-06-13 20:41:23 (GMT)
committerGitHub <noreply@github.com>2019-06-13 20:41:23 (GMT)
commit838f26402de82640698c38ea9d2be65c6cf780d6 (patch)
treeb5dfe2fa1c398c93291833fbd7beea911613a4b1 /Python/pylifecycle.c
parent3498c642f4e83f3d8e2214654c0fa8e0d51cebe5 (diff)
downloadcpython-838f26402de82640698c38ea9d2be65c6cf780d6.zip
cpython-838f26402de82640698c38ea9d2be65c6cf780d6.tar.gz
cpython-838f26402de82640698c38ea9d2be65c6cf780d6.tar.bz2
bpo-36710: Pass explicitly tstate in sysmodule.c (GH-14060)
* Replace global var Py_VerboseFlag with interp->config.verbose. * Add _PyErr_NoMemory(tstate) function. * Add tstate parameter to _PyEval_SetCoroutineOriginTrackingDepth() and move the function to the internal API. * Replace _PySys_InitMain(runtime, interp) with _PySys_InitMain(runtime, tstate).
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 751c4d6..54e8ce2 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -899,6 +899,7 @@ pyinit_main(_PyRuntimeState *runtime, PyInterpreterState *interp)
}
/* Configure the main interpreter */
+ PyThreadState *tstate = _PyRuntimeState_GetThreadState(runtime);
PyConfig *config = &interp->config;
if (runtime->initialized) {
@@ -919,7 +920,7 @@ pyinit_main(_PyRuntimeState *runtime, PyInterpreterState *interp)
return _PyStatus_ERR("can't initialize time");
}
- if (_PySys_InitMain(runtime, interp) < 0) {
+ if (_PySys_InitMain(runtime, tstate) < 0) {
return _PyStatus_ERR("can't finish initializing sys");
}
@@ -1456,7 +1457,7 @@ new_interpreter(PyThreadState **tstate_p)
}
Py_INCREF(interp->sysdict);
PyDict_SetItemString(interp->sysdict, "modules", modules);
- if (_PySys_InitMain(runtime, interp) < 0) {
+ if (_PySys_InitMain(runtime, tstate) < 0) {
return _PyStatus_ERR("can't finish initializing sys");
}
}