mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Revert "bpo-36818: Add PyInterpreterState.runtime field. (gh-13129)" (GH-13795)
This reverts commit 396e0a8d9d
.
This commit is contained in:
parent
9535aff942
commit
0fd2c300c2
11 changed files with 103 additions and 99 deletions
|
@ -545,7 +545,7 @@ pycore_create_interpreter(_PyRuntimeState *runtime,
|
|||
_PyEval_FiniThreads(&runtime->ceval);
|
||||
|
||||
/* Auto-thread-state API */
|
||||
_PyGILState_Init(tstate);
|
||||
_PyGILState_Init(runtime, interp, tstate);
|
||||
|
||||
/* Create the GIL */
|
||||
PyEval_InitThreads();
|
||||
|
@ -683,7 +683,7 @@ pyinit_config(_PyRuntimeState *runtime,
|
|||
}
|
||||
|
||||
PyObject *sysmod;
|
||||
status = _PySys_Create(interp, &sysmod);
|
||||
status = _PySys_Create(runtime, interp, &sysmod);
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
return status;
|
||||
}
|
||||
|
@ -892,9 +892,8 @@ _Py_ReconfigureMainInterpreter(PyInterpreterState *interp)
|
|||
* non-zero return code.
|
||||
*/
|
||||
static PyStatus
|
||||
pyinit_main(PyInterpreterState *interp)
|
||||
pyinit_main(_PyRuntimeState *runtime, PyInterpreterState *interp)
|
||||
{
|
||||
_PyRuntimeState *runtime = interp->runtime;
|
||||
if (!runtime->core_initialized) {
|
||||
return _PyStatus_ERR("runtime core not initialized");
|
||||
}
|
||||
|
@ -920,7 +919,7 @@ pyinit_main(PyInterpreterState *interp)
|
|||
return _PyStatus_ERR("can't initialize time");
|
||||
}
|
||||
|
||||
if (_PySys_InitMain(interp) < 0) {
|
||||
if (_PySys_InitMain(runtime, interp) < 0) {
|
||||
return _PyStatus_ERR("can't finish initializing sys");
|
||||
}
|
||||
|
||||
|
@ -1000,7 +999,7 @@ _Py_InitializeMain(void)
|
|||
_PyRuntimeState *runtime = &_PyRuntime;
|
||||
PyInterpreterState *interp = _PyRuntimeState_GetThreadState(runtime)->interp;
|
||||
|
||||
return pyinit_main(interp);
|
||||
return pyinit_main(runtime, interp);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1027,7 +1026,7 @@ Py_InitializeFromConfig(const PyConfig *config)
|
|||
config = &interp->config;
|
||||
|
||||
if (config->_init_main) {
|
||||
status = pyinit_main(interp);
|
||||
status = pyinit_main(runtime, interp);
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
return status;
|
||||
}
|
||||
|
@ -1457,7 +1456,7 @@ new_interpreter(PyThreadState **tstate_p)
|
|||
}
|
||||
Py_INCREF(interp->sysdict);
|
||||
PyDict_SetItemString(interp->sysdict, "modules", modules);
|
||||
if (_PySys_InitMain(interp) < 0) {
|
||||
if (_PySys_InitMain(runtime, interp) < 0) {
|
||||
return _PyStatus_ERR("can't finish initializing sys");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue