mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
bpo-36301: Cleanup preconfig.c and coreconfig.c (GH-12563)
* _PyCoreConfig_Write() now updates _PyRuntime.preconfig * Remove _PyPreCmdline_Copy() * _PyPreCmdline_Read() now accepts _PyPreConfig and _PyCoreConfig optional configurations. * Rename _PyPreConfig_ReadFromArgv() to _PyPreConfig_Read(). Simplify the code. * Calling _PyCoreConfig_Read() no longer adds the warning options twice: don't add a warning option if it's already in the list. * Rename _PyCoreConfig_ReadFromArgv() to _PyCoreConfig_Read(). * Rename config_from_cmdline() to _PyCoreConfig_ReadFromArgv(). * Add more assertions on _PyCoreConfig in _PyCoreConfig_Read(). * Move some functions. * Make some config functions private.
This commit is contained in:
parent
414b1cde93
commit
f8ba6f5afc
9 changed files with 658 additions and 695 deletions
|
@ -302,7 +302,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
|
|||
'pycache_prefix': None,
|
||||
'program_name': './_testembed',
|
||||
'argv': [""],
|
||||
'program': None,
|
||||
'program': '',
|
||||
|
||||
'xoptions': [],
|
||||
'warnoptions': [],
|
||||
|
@ -537,6 +537,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
|
|||
'program_name': './globalvar',
|
||||
'site_import': 0,
|
||||
'bytes_warning': 1,
|
||||
'warnoptions': ['default::BytesWarning'],
|
||||
'inspect': 1,
|
||||
'interactive': 1,
|
||||
'optimization_level': 2,
|
||||
|
@ -579,7 +580,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
|
|||
'argv': ['-c', 'pass'],
|
||||
'program': 'conf_program',
|
||||
'xoptions': ['core_xoption1=3', 'core_xoption2=', 'core_xoption3'],
|
||||
'warnoptions': ['default', 'error::ResourceWarning'],
|
||||
'warnoptions': ['error::ResourceWarning', 'default::BytesWarning'],
|
||||
|
||||
'site_import': 0,
|
||||
'bytes_warning': 1,
|
||||
|
@ -629,14 +630,16 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
|
|||
preconfig = dict(self.INIT_ENV_PRECONFIG,
|
||||
allocator='debug')
|
||||
config = dict(self.INIT_ENV_CONFIG,
|
||||
dev_mode=1)
|
||||
dev_mode=1,
|
||||
warnoptions=['default'])
|
||||
self.check_config("init_env_dev_mode", config, preconfig)
|
||||
|
||||
def test_init_env_dev_mode_alloc(self):
|
||||
preconfig = dict(self.INIT_ENV_PRECONFIG,
|
||||
allocator='malloc')
|
||||
config = dict(self.INIT_ENV_CONFIG,
|
||||
dev_mode=1)
|
||||
dev_mode=1,
|
||||
warnoptions=['default'])
|
||||
self.check_config("init_env_dev_mode_alloc", config, preconfig)
|
||||
|
||||
def test_init_dev_mode(self):
|
||||
|
@ -646,14 +649,12 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
|
|||
config = {
|
||||
'faulthandler': 1,
|
||||
'dev_mode': 1,
|
||||
'warnoptions': ['default'],
|
||||
}
|
||||
self.check_config("init_dev_mode", config, preconfig)
|
||||
|
||||
def test_init_isolated(self):
|
||||
preconfig = {
|
||||
'isolated': 0,
|
||||
'use_environment': 1,
|
||||
}
|
||||
preconfig = {}
|
||||
config = {
|
||||
'isolated': 1,
|
||||
'use_environment': 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue