summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-12-20 18:36:46 (GMT)
committerGitHub <noreply@github.com>2017-12-20 18:36:46 (GMT)
commit9cfc00262c7f6b93072762eed1dc5d94fa3897f0 (patch)
treef40640841b04f938fc3b0a0628fa5c680887fd9e /Python
parent51eb1c6b9c0b382dfd6e0428eacff0c7891a6fc3 (diff)
downloadcpython-9cfc00262c7f6b93072762eed1dc5d94fa3897f0.zip
cpython-9cfc00262c7f6b93072762eed1dc5d94fa3897f0.tar.gz
cpython-9cfc00262c7f6b93072762eed1dc5d94fa3897f0.tar.bz2
bpo-32030: Complete _PyCoreConfig_Read() (#4946)
* Add _PyCoreConfig.install_signal_handlers * Remove _PyMain.config: _PyMainInterpreterConfig usage is now restricted to pymain_init_python_main(). * Rename _PyMain.core_config to _PyMain.config * _PyMainInterpreterConfig_Read() now creates the xoptions dictionary from the core config * Fix _PyMainInterpreterConfig_Read(): don't replace xoptions and argv if they are already set.
Diffstat (limited to 'Python')
-rw-r--r--Python/pylifecycle.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 79fcb57..2af76d7 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -874,30 +874,29 @@ _Py_InitializeMainInterpreter(const _PyMainInterpreterConfig *config)
_PyInitError
_Py_InitializeEx_Private(int install_sigs, int install_importlib)
{
- _PyCoreConfig core_config = _PyCoreConfig_INIT;
- _PyMainInterpreterConfig config = _PyMainInterpreterConfig_INIT;
+ _PyCoreConfig config = _PyCoreConfig_INIT;
_PyInitError err;
- core_config.ignore_environment = Py_IgnoreEnvironmentFlag;
- core_config._disable_importlib = !install_importlib;
+ config.ignore_environment = Py_IgnoreEnvironmentFlag;
+ config._disable_importlib = !install_importlib;
config.install_signal_handlers = install_sigs;
- err = _PyCoreConfig_Read(&core_config);
+ err = _PyCoreConfig_Read(&config);
if (_Py_INIT_FAILED(err)) {
goto done;
}
- err = _Py_InitializeCore(&core_config);
+ err = _Py_InitializeCore(&config);
if (_Py_INIT_FAILED(err)) {
goto done;
}
- err = _PyMainInterpreterConfig_Read(&config, &core_config);
- if (_Py_INIT_FAILED(err)) {
- goto done;
+ _PyMainInterpreterConfig main_config = _PyMainInterpreterConfig_INIT;
+ err = _PyMainInterpreterConfig_Read(&main_config, &config);
+ if (!_Py_INIT_FAILED(err)) {
+ err = _Py_InitializeMainInterpreter(&main_config);
}
-
- err = _Py_InitializeMainInterpreter(&config);
+ _PyMainInterpreterConfig_Clear(&main_config);
if (_Py_INIT_FAILED(err)) {
goto done;
}
@@ -905,8 +904,7 @@ _Py_InitializeEx_Private(int install_sigs, int install_importlib)
err = _Py_INIT_OK();
done:
- _PyCoreConfig_Clear(&core_config);
- _PyMainInterpreterConfig_Clear(&config);
+ _PyCoreConfig_Clear(&config);
return err;
}