diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-03-27 02:04:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-27 02:04:16 +0100 |
commit | 484f20d2ff95cc2e1bea759852da307bc1d1d944 (patch) | |
tree | 2f170dbbabfbff21d45d5c87d9bc0ecd73ba31ad /Programs | |
parent | bpo-36444: Remove _PyMainInterpreterConfig (GH-12571) (diff) | |
download | cpython-484f20d2ff95cc2e1bea759852da307bc1d1d944.tar.gz cpython-484f20d2ff95cc2e1bea759852da307bc1d1d944.tar.bz2 cpython-484f20d2ff95cc2e1bea759852da307bc1d1d944.zip |
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.
Diffstat (limited to 'Programs')
-rw-r--r-- | Programs/_freeze_importlib.c | 3 | ||||
-rw-r--r-- | Programs/_testembed.c | 10 |
2 files changed, 7 insertions, 6 deletions
diff --git a/Programs/_freeze_importlib.c b/Programs/_freeze_importlib.c index 0818012d8c5..774748dc091 100644 --- a/Programs/_freeze_importlib.c +++ b/Programs/_freeze_importlib.c @@ -84,8 +84,9 @@ main(int argc, char *argv[]) /* Don't install importlib, since it could execute outdated bytecode. */ config._install_importlib = 0; config._frozen = 1; + config._init_main = 0; - _PyInitError err = _Py_InitializeFromConfig(&config); + _PyInitError err = _Py_InitializeFromConfig(&config, NULL); /* No need to call _PyCoreConfig_Clear() since we didn't allocate any memory: program_name is a constant string. */ if (_Py_INIT_FAILED(err)) { diff --git a/Programs/_testembed.c b/Programs/_testembed.c index 76de8aab5ba..70587990f8d 100644 --- a/Programs/_testembed.c +++ b/Programs/_testembed.c @@ -529,7 +529,7 @@ static int test_init_from_config(void) Py_FrozenFlag = 0; config._frozen = 1; - err = _Py_InitializeFromConfig(&config); + err = _Py_InitializeFromConfig(&config, NULL); /* Don't call _PyCoreConfig_Clear() since all strings are static */ if (_Py_INIT_FAILED(err)) { _Py_ExitInitError(err); @@ -638,7 +638,7 @@ static int test_init_isolated(void) config.program_name = L"./_testembed"; test_init_env_dev_mode_putenvs(); - err = _Py_InitializeFromConfig(&config); + err = _Py_InitializeFromConfig(&config, NULL); if (_Py_INIT_FAILED(err)) { _Py_ExitInitError(err); } @@ -669,7 +669,7 @@ static int test_preinit_isolated1(void) config.program_name = L"./_testembed"; test_init_env_dev_mode_putenvs(); - err = _Py_InitializeFromConfig(&config); + err = _Py_InitializeFromConfig(&config, NULL); if (_Py_INIT_FAILED(err)) { _Py_ExitInitError(err); } @@ -706,7 +706,7 @@ static int test_preinit_isolated2(void) config.program_name = L"./_testembed"; test_init_env_dev_mode_putenvs(); - err = _Py_InitializeFromConfig(&config); + err = _Py_InitializeFromConfig(&config, NULL); if (_Py_INIT_FAILED(err)) { _Py_ExitInitError(err); } @@ -723,7 +723,7 @@ static int test_init_dev_mode(void) putenv("PYTHONMALLOC="); config.dev_mode = 1; config.program_name = L"./_testembed"; - _PyInitError err = _Py_InitializeFromConfig(&config); + _PyInitError err = _Py_InitializeFromConfig(&config, NULL); if (_Py_INIT_FAILED(err)) { _Py_ExitInitError(err); } |