diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-12-14 01:20:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-14 01:20:52 (GMT) |
commit | b5fd9ad05e0f15f8272b8f1b829af22077230584 (patch) | |
tree | 14c128a5e3b71864726d6fae4a414883ce6b9440 /Python/pathconfig.c | |
parent | 176baa326be4ec2dc70ca0c054b7e2ab7ca6a9cf (diff) | |
download | cpython-b5fd9ad05e0f15f8272b8f1b829af22077230584.zip cpython-b5fd9ad05e0f15f8272b8f1b829af22077230584.tar.gz cpython-b5fd9ad05e0f15f8272b8f1b829af22077230584.tar.bz2 |
bpo-32030: Rewrite _PyMainInterpreterConfig (#4854)
_PyMainInterpreterConfig now contains Python objects, whereas
_PyCoreConfig contains wchar_t* strings.
Core config:
* Rename _PyMainInterpreterConfig_ReadEnv() to _PyCoreConfig_ReadEnv()
* Move 3 strings from _PyMainInterpreterConfig to _PyCoreConfig:
module_search_path_env, home, program_name.
* Add _PyCoreConfig_Clear()
* _PyPathConfig_Calculate() now takes core config rather than main
config
* _PyMainInterpreterConfig_Read() now requires also a core config
Main config:
* Add _PyMainInterpreterConfig.module_search_path: sys.path list
* Add _PyMainInterpreterConfig.argv: sys.argv list
* _PyMainInterpreterConfig_Read() now computes module_search_path
Diffstat (limited to 'Python/pathconfig.c')
-rw-r--r-- | Python/pathconfig.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Python/pathconfig.c b/Python/pathconfig.c index b17ae82..748084b 100644 --- a/Python/pathconfig.c +++ b/Python/pathconfig.c @@ -46,7 +46,7 @@ _PyPathConfig_Clear(_PyPathConfig *config) /* Initialize paths for Py_GetPath(), Py_GetPrefix(), Py_GetExecPrefix() and Py_GetProgramFullPath() */ _PyInitError -_PyPathConfig_Init(const _PyMainInterpreterConfig *main_config) +_PyPathConfig_Init(const _PyCoreConfig *core_config) { if (_Py_path_config.module_search_path) { /* Already initialized */ @@ -61,15 +61,15 @@ _PyPathConfig_Init(const _PyMainInterpreterConfig *main_config) /* Calculate program_full_path, prefix, exec_prefix (Unix) or dll_path (Windows), and module_search_path */ - err = _PyPathConfig_Calculate(&new_config, main_config); + err = _PyPathConfig_Calculate(&new_config, core_config); if (_Py_INIT_FAILED(err)) { _PyPathConfig_Clear(&new_config); goto done; } - /* Copy home and program_name from main_config */ - if (main_config->home != NULL) { - new_config.home = _PyMem_RawWcsdup(main_config->home); + /* Copy home and program_name from core_config */ + if (core_config->home != NULL) { + new_config.home = _PyMem_RawWcsdup(core_config->home); if (new_config.home == NULL) { err = _Py_INIT_NO_MEMORY(); goto done; @@ -79,7 +79,7 @@ _PyPathConfig_Init(const _PyMainInterpreterConfig *main_config) new_config.home = NULL; } - new_config.program_name = _PyMem_RawWcsdup(main_config->program_name); + new_config.program_name = _PyMem_RawWcsdup(core_config->program_name); if (new_config.program_name == NULL) { err = _Py_INIT_NO_MEMORY(); goto done; @@ -105,14 +105,14 @@ pathconfig_global_init(void) } _PyInitError err; - _PyMainInterpreterConfig config = _PyMainInterpreterConfig_INIT; + _PyCoreConfig config = _PyCoreConfig_INIT; - err = _PyMainInterpreterConfig_ReadEnv(&config); + err = _PyCoreConfig_ReadEnv(&config); if (_Py_INIT_FAILED(err)) { goto error; } - err = _PyMainInterpreterConfig_Read(&config); + err = _PyCoreConfig_Read(&config); if (_Py_INIT_FAILED(err)) { goto error; } @@ -122,11 +122,11 @@ pathconfig_global_init(void) goto error; } - _PyMainInterpreterConfig_Clear(&config); + _PyCoreConfig_Clear(&config); return; error: - _PyMainInterpreterConfig_Clear(&config); + _PyCoreConfig_Clear(&config); _Py_FatalInitError(err); } |