summaryrefslogtreecommitdiffstats
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2019-06-01 03:16:47 (GMT)
committerGitHub <noreply@github.com>2019-06-01 03:16:47 (GMT)
commit396e0a8d9dc65453cb9d53500d0a620602656cfe (patch)
treee960fe3a38051fd3013bae7fd1b788ca94e9aeca /Python/pylifecycle.c
parent1c263e39c4ed28225a7dc8ca1f24953225ac48ca (diff)
downloadcpython-396e0a8d9dc65453cb9d53500d0a620602656cfe.zip
cpython-396e0a8d9dc65453cb9d53500d0a620602656cfe.tar.gz
cpython-396e0a8d9dc65453cb9d53500d0a620602656cfe.tar.bz2
bpo-36818: Add PyInterpreterState.runtime field. (gh-13129)
https://bugs.python.org/issue36818
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 10a2881..6590ef8 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -545,7 +545,7 @@ pycore_create_interpreter(_PyRuntimeState *runtime,
_PyEval_FiniThreads(&runtime->ceval);
/* Auto-thread-state API */
- _PyGILState_Init(runtime, interp, tstate);
+ _PyGILState_Init(tstate);
/* Create the GIL */
PyEval_InitThreads();
@@ -683,7 +683,7 @@ pyinit_config(_PyRuntimeState *runtime,
}
PyObject *sysmod;
- status = _PySys_Create(runtime, interp, &sysmod);
+ status = _PySys_Create(interp, &sysmod);
if (_PyStatus_EXCEPTION(status)) {
return status;
}
@@ -892,8 +892,9 @@ _Py_ReconfigureMainInterpreter(PyInterpreterState *interp)
* non-zero return code.
*/
static PyStatus
-pyinit_main(_PyRuntimeState *runtime, PyInterpreterState *interp)
+pyinit_main(PyInterpreterState *interp)
{
+ _PyRuntimeState *runtime = interp->runtime;
if (!runtime->core_initialized) {
return _PyStatus_ERR("runtime core not 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(interp) < 0) {
return _PyStatus_ERR("can't finish initializing sys");
}
@@ -999,7 +1000,7 @@ _Py_InitializeMain(void)
_PyRuntimeState *runtime = &_PyRuntime;
PyInterpreterState *interp = _PyRuntimeState_GetThreadState(runtime)->interp;
- return pyinit_main(runtime, interp);
+ return pyinit_main(interp);
}
@@ -1026,7 +1027,7 @@ Py_InitializeFromConfig(const PyConfig *config)
config = &interp->config;
if (config->_init_main) {
- status = pyinit_main(runtime, interp);
+ status = pyinit_main(interp);
if (_PyStatus_EXCEPTION(status)) {
return status;
}
@@ -1453,7 +1454,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(interp) < 0) {
return _PyStatus_ERR("can't finish initializing sys");
}
}