diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-03-05 17:37:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-05 17:37:44 +0100 |
commit | b35be4b3334fbc471a39abbeb68110867b72e3e5 (patch) | |
tree | 4c311249db97ae7ebc5d2cb9ed48791549512afe /Python/coreconfig.c | |
parent | 359a2f3daba49fde0d3a07fb3c7a8b051c450d08 (diff) | |
download | cpython-b35be4b3334fbc471a39abbeb68110867b72e3e5.tar.gz cpython-b35be4b3334fbc471a39abbeb68110867b72e3e5.zip |
bpo-36142: Add _PyPreConfig.allocator (GH-12181)
* Move 'allocator' and 'dev_mode' fields from _PyCoreConfig
to _PyPreConfig.
* Fix InitConfigTests of test_embed: dev_mode sets allocator to
"debug", add a new tests for env vars with dev mode enabled.
Diffstat (limited to 'Python/coreconfig.c')
-rw-r--r-- | Python/coreconfig.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/Python/coreconfig.c b/Python/coreconfig.c index e372de48247..42441e24aa6 100644 --- a/Python/coreconfig.c +++ b/Python/coreconfig.c @@ -521,8 +521,6 @@ _PyCoreConfig_Copy(_PyCoreConfig *config, const _PyCoreConfig *config2) COPY_ATTR(use_hash_seed); COPY_ATTR(hash_seed); COPY_ATTR(_install_importlib); - COPY_ATTR(allocator); - COPY_ATTR(dev_mode); COPY_ATTR(faulthandler); COPY_ATTR(tracemalloc); COPY_ATTR(import_time); @@ -931,10 +929,6 @@ config_read_env_vars(_PyCoreConfig *config) "PYTHONLEGACYWINDOWSSTDIO"); #endif - if (config->allocator == NULL) { - config->allocator = _PyCoreConfig_GetEnv(config, "PYTHONMALLOC"); - } - if (_PyCoreConfig_GetEnv(config, "PYTHONDUMPREFS")) { config->dump_refs = 1; } @@ -1059,11 +1053,6 @@ config_read_complex_options(_PyCoreConfig *config) || config_get_xoption(config, L"importtime")) { config->import_time = 1; } - if (config_get_xoption(config, L"dev" ) || - _PyCoreConfig_GetEnv(config, "PYTHONDEVMODE")) - { - config->dev_mode = 1; - } _PyInitError err; if (config->tracemalloc < 0) { @@ -1427,13 +1416,10 @@ _PyCoreConfig_Read(_PyCoreConfig *config, const _PyPreConfig *preconfig) } /* default values */ - if (config->dev_mode) { + if (config->preconfig.dev_mode) { if (config->faulthandler < 0) { config->faulthandler = 1; } - if (config->allocator == NULL) { - config->allocator = "debug"; - } } if (config->use_hash_seed < 0) { config->use_hash_seed = 0; @@ -1572,8 +1558,6 @@ _PyCoreConfig_AsDict(const _PyCoreConfig *config) SET_ITEM_INT(install_signal_handlers); SET_ITEM_INT(use_hash_seed); SET_ITEM_UINT(hash_seed); - SET_ITEM_STR(allocator); - SET_ITEM_INT(dev_mode); SET_ITEM_INT(faulthandler); SET_ITEM_INT(tracemalloc); SET_ITEM_INT(import_time); @@ -1950,7 +1934,7 @@ config_init_warnoptions(_PyCoreConfig *config, const _PyCmdline *cmdline) * the lowest precedence entries first so that later entries override them. */ - if (config->dev_mode) { + if (config->preconfig.dev_mode) { err = _Py_wstrlist_append(&config->nwarnoption, &config->warnoptions, L"default"); |