diff options
-rw-r--r-- | Python/pylifecycle.c | 56 |
1 files changed, 24 insertions, 32 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 9822cce..8bd71a3 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -702,42 +702,51 @@ pycore_init_import_warnings(PyThreadState *tstate, PyObject *sysmod) static PyStatus -pyinit_config(_PyRuntimeState *runtime, - PyThreadState **tstate_p, - const PyConfig *config) +pycore_interp_init(PyThreadState *tstate) { - _PyConfig_Write(config, runtime); + PyStatus status; - PyStatus status = pycore_init_runtime(runtime, config); + status = pycore_init_types(tstate); if (_PyStatus_EXCEPTION(status)) { return status; } - PyThreadState *tstate; - status = pycore_create_interpreter(runtime, config, &tstate); + PyObject *sysmod; + status = _PySys_Create(tstate, &sysmod); if (_PyStatus_EXCEPTION(status)) { return status; } - config = &tstate->interp->config; - *tstate_p = tstate; - status = pycore_init_types(tstate); + status = pycore_init_builtins(tstate); if (_PyStatus_EXCEPTION(status)) { return status; } - PyObject *sysmod; - status = _PySys_Create(tstate, &sysmod); + return pycore_init_import_warnings(tstate, sysmod); +} + + +static PyStatus +pyinit_config(_PyRuntimeState *runtime, + PyThreadState **tstate_p, + const PyConfig *config) +{ + _PyConfig_Write(config, runtime); + + PyStatus status = pycore_init_runtime(runtime, config); if (_PyStatus_EXCEPTION(status)) { return status; } - status = pycore_init_builtins(tstate); + PyThreadState *tstate; + status = pycore_create_interpreter(runtime, config, &tstate); if (_PyStatus_EXCEPTION(status)) { return status; } + config = &tstate->interp->config; + *tstate_p = tstate; - status = pycore_init_import_warnings(tstate, sysmod); + status = pycore_interp_init(tstate); if (_PyStatus_EXCEPTION(status)) { return status; } @@ -1549,25 +1558,8 @@ new_interpreter(PyThreadState **tstate_p) if (_PyStatus_EXCEPTION(status)) { goto error; } - config = &interp->config; - - status = pycore_init_types(tstate); - if (_PyStatus_EXCEPTION(status)) { - goto error; - } - - PyObject *sysmod; - status = _PySys_Create(tstate, &sysmod); - if (_PyStatus_EXCEPTION(status)) { - return status; - } - - status = pycore_init_builtins(tstate); - if (_PyStatus_EXCEPTION(status)) { - goto error; - } - status = pycore_init_import_warnings(tstate, sysmod); + status = pycore_interp_init(tstate); if (_PyStatus_EXCEPTION(status)) { goto error; } |