bpo-42260: Add _PyConfig_FromDict() (GH-23167)

* Rename config_as_dict() to _PyConfig_AsDict().
* Add 'module_search_paths_set' to _PyConfig_AsDict().
* Add _PyConfig_FromDict().
* Add get_config() and set_config() to _testinternalcapi.
* Add config_check_consistency().
This commit is contained in:
Victor Stinner 2020-11-05 18:12:33 +01:00 committed by GitHub
parent 4662fa9bfe
commit f3cb814315
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 653 additions and 60 deletions

View file

@ -2922,7 +2922,9 @@ _PySys_UpdateConfig(PyThreadState *tstate)
#define SET_SYS_FROM_WSTR(KEY, VALUE) \
SET_SYS(KEY, PyUnicode_FromWideChar(VALUE, -1));
COPY_LIST("path", config->module_search_paths);
if (config->module_search_paths_set) {
COPY_LIST("path", config->module_search_paths);
}
SET_SYS_FROM_WSTR("executable", config->executable);
SET_SYS_FROM_WSTR("_base_executable", config->base_executable);