diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-03-26 01:31:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-26 01:31:11 (GMT) |
commit | 20004959d23d07ac784eef51ecb161012180faa8 (patch) | |
tree | 7fcc04b0924c2180d234196d3886e58cb57e2609 /Modules | |
parent | f78a5e9ce8f32a195f5f788aade79578437f30a6 (diff) | |
download | cpython-20004959d23d07ac784eef51ecb161012180faa8.zip cpython-20004959d23d07ac784eef51ecb161012180faa8.tar.gz cpython-20004959d23d07ac784eef51ecb161012180faa8.tar.bz2 |
bpo-36301: Remove _PyCoreConfig.preconfig (GH-12546)
* Replace _PyCoreConfig.preconfig with 3 new fields in _PyCoreConfig:
isolated, use_environment, dev_mode.
* Add _PyPreCmdline.dev_mode.
* Add _Py_PreInitializeFromPreConfigInPlace().
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/main.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/Modules/main.c b/Modules/main.c index 46bc72a..9fcc76e 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -294,7 +294,7 @@ pymain_init_preconfig(const _PyArgv *args) goto done; } - err = _Py_PreInitializeFromPreConfig(&config); + err = _Py_PreInitializeInPlace(&config); done: _PyPreConfig_Clear(&config); @@ -311,11 +311,6 @@ pymain_init_coreconfig(_PyCoreConfig *config, const _PyArgv *args, return err; } - err = _PyCoreConfig_Write(config); - if (_Py_INIT_FAILED(err)) { - return err; - } - return _Py_InitializeCore(interp_p, config); } @@ -483,7 +478,7 @@ pymain_header(const _PyCoreConfig *config) static void pymain_import_readline(const _PyCoreConfig *config) { - if (config->preconfig.isolated) { + if (config->isolated) { return; } if (!config->inspect && RUN_CODE(config)) { @@ -655,7 +650,7 @@ pymain_run_file(_PyCoreConfig *config, PyCompilerFlags *cf) static void pymain_run_startup(_PyCoreConfig *config, PyCompilerFlags *cf) { - const char *startup = _Py_GetEnv(config->preconfig.use_environment, "PYTHONSTARTUP"); + const char *startup = _Py_GetEnv(config->use_environment, "PYTHONSTARTUP"); if (startup == NULL) { return; } @@ -735,7 +730,7 @@ pymain_repl(_PyCoreConfig *config, PyCompilerFlags *cf, int *exitcode) { /* Check this environment variable at the end, to give programs the opportunity to set it from Python. */ - if (!Py_InspectFlag && _Py_GetEnv(config->preconfig.use_environment, "PYTHONINSPECT")) { + if (!Py_InspectFlag && _Py_GetEnv(config->use_environment, "PYTHONINSPECT")) { Py_InspectFlag = 1; config->inspect = 1; } @@ -775,7 +770,7 @@ pymain_run_python(PyInterpreterState *interp, int *exitcode) goto done; } } - else if (!config->preconfig.isolated) { + else if (!config->isolated) { PyObject *path0 = NULL; if (_PyPathConfig_ComputeSysPath0(&config->argv, &path0)) { if (path0 == NULL) { |