mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
bpo-36444: Add _PyCoreConfig._init_main (GH-12572)
* Add _PyCoreConfig._init_main: if equals to zero, _Py_InitializeFromConfig() doesn't call _Py_InitializeMainInterpreter(). * Add interp_p parameter to _Py_InitializeFromConfig(). * pymain_init() now calls _Py_InitializeFromConfig(). * Make _Py_InitializeCore() private.
This commit is contained in:
parent
8b9dbc017a
commit
484f20d2ff
9 changed files with 47 additions and 46 deletions
|
|
@ -53,19 +53,6 @@ done:
|
|||
}
|
||||
|
||||
|
||||
static _PyInitError
|
||||
pymain_init_coreconfig(_PyCoreConfig *config, const _PyArgv *args,
|
||||
PyInterpreterState **interp_p)
|
||||
{
|
||||
_PyInitError err = _PyCoreConfig_Read(config, args);
|
||||
if (_Py_INIT_FAILED(err)) {
|
||||
return err;
|
||||
}
|
||||
|
||||
return _Py_InitializeCore(config, interp_p);
|
||||
}
|
||||
|
||||
|
||||
static _PyInitError
|
||||
pymain_init(const _PyArgv *args, PyInterpreterState **interp_p)
|
||||
{
|
||||
|
|
@ -91,18 +78,22 @@ pymain_init(const _PyArgv *args, PyInterpreterState **interp_p)
|
|||
}
|
||||
|
||||
_PyCoreConfig config = _PyCoreConfig_INIT;
|
||||
err = pymain_init_coreconfig(&config, args, interp_p);
|
||||
|
||||
err = _PyCoreConfig_Read(&config, args);
|
||||
if (_Py_INIT_FAILED(err)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
err = _Py_InitializeFromConfig(&config, interp_p);
|
||||
if (_Py_INIT_FAILED(err)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
err = _Py_INIT_OK();
|
||||
|
||||
done:
|
||||
_PyCoreConfig_Clear(&config);
|
||||
if (_Py_INIT_FAILED(err)) {
|
||||
return err;
|
||||
}
|
||||
|
||||
err = _Py_InitializeMainInterpreter(*interp_p);
|
||||
if (_Py_INIT_FAILED(err)) {
|
||||
return err;
|
||||
}
|
||||
|
||||
return _Py_INIT_OK();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue