mirror of
https://github.com/python/cpython.git
synced 2025-08-26 19:55:24 +00:00
bpo-36301: Add _Py_GetConfigsAsDict() function (GH-12540)
* Add _Py_GetConfigsAsDict() function to get all configurations as a dict. * dump_config() of _testembed.c now dumps preconfig as a separated key: call _Py_GetConfigsAsDict(). * Make _PyMainInterpreterConfig_AsDict() private.
This commit is contained in:
parent
91759d9801
commit
1075d1684a
9 changed files with 179 additions and 134 deletions
|
@ -598,18 +598,15 @@ def collect_get_config(info_add):
|
|||
# Dump global configuration variables, _PyCoreConfig
|
||||
# and _PyMainInterpreterConfig
|
||||
try:
|
||||
from _testcapi import get_global_config, get_core_config, get_main_config
|
||||
from _testcapi import get_configs
|
||||
except ImportError:
|
||||
return
|
||||
|
||||
for prefix, get_config_func in (
|
||||
('global_config', get_global_config),
|
||||
('core_config', get_core_config),
|
||||
('main_config', get_main_config),
|
||||
):
|
||||
config = get_config_func()
|
||||
all_configs = get_configs()
|
||||
for config_type in sorted(all_configs):
|
||||
config = all_configs[config_type]
|
||||
for key in sorted(config):
|
||||
info_add('%s[%s]' % (prefix, key), repr(config[key]))
|
||||
info_add('%s[%s]' % (config_type, key), repr(config[key]))
|
||||
|
||||
|
||||
def collect_subprocess(info_add):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue