gh-107954, PEP 741: Adjust Python initialization config (#123663)

Setting dev_mode to 1 in an isolated configuration now enables also
faulthandler.

Moreover, setting "module_search_paths" option with
PyInitConfig_SetStrList() now sets "module_search_paths_set" to 1.
This commit is contained in:
Victor Stinner 2024-09-04 12:58:32 +02:00 committed by GitHub
parent 7bd964dbbe
commit b423ae6b08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 43 additions and 16 deletions

View file

@ -1031,7 +1031,6 @@ PyConfig_InitIsolatedConfig(PyConfig *config)
config->dev_mode = 0;
config->install_signal_handlers = 0;
config->use_hash_seed = 0;
config->faulthandler = 0;
config->tracemalloc = 0;
config->perf_profiling = 0;
config->int_max_str_digits = _PY_LONG_DEFAULT_MAX_STR_DIGITS;
@ -3753,7 +3752,7 @@ PyInitConfig_SetInt(PyInitConfig *config, const char *name, int64_t value)
return -1;
}
if (strcmp(name, "hash_seed")) {
if (strcmp(name, "hash_seed") == 0) {
config->config.use_hash_seed = 1;
}
@ -3863,7 +3862,14 @@ PyInitConfig_SetStrList(PyInitConfig *config, const char *name,
return -1;
}
PyWideStringList *list = raw_member;
return _PyWideStringList_FromUTF8(config, list, length, items);
if (_PyWideStringList_FromUTF8(config, list, length, items) < 0) {
return -1;
}
if (strcmp(name, "module_search_paths") == 0) {
config->config.module_search_paths_set = 1;
}
return 0;
}