mirror of
https://github.com/python/cpython.git
synced 2025-09-01 14:38:00 +00:00
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:
parent
4662fa9bfe
commit
f3cb814315
6 changed files with 653 additions and 60 deletions
|
@ -30,6 +30,8 @@ API_PYTHON = 2
|
|||
# _PyCoreConfig_InitIsolatedConfig()
|
||||
API_ISOLATED = 3
|
||||
|
||||
MAX_HASH_SEED = 4294967295
|
||||
|
||||
|
||||
def debug_build(program):
|
||||
program = os.path.basename(program)
|
||||
|
@ -382,6 +384,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
|
|||
'exec_prefix': GET_DEFAULT_CONFIG,
|
||||
'base_exec_prefix': GET_DEFAULT_CONFIG,
|
||||
'module_search_paths': GET_DEFAULT_CONFIG,
|
||||
'module_search_paths_set': 1,
|
||||
'platlibdir': sys.platlibdir,
|
||||
|
||||
'site_import': 1,
|
||||
|
@ -1408,6 +1411,17 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
|
|||
# ignore output
|
||||
|
||||
|
||||
class SetConfigTests(unittest.TestCase):
|
||||
def test_set_config(self):
|
||||
# bpo-42260: Test _PyInterpreterState_SetConfig()
|
||||
cmd = [sys.executable, '-I', '-m', 'test._test_embed_set_config']
|
||||
proc = subprocess.run(cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
self.assertEqual(proc.returncode, 0,
|
||||
(proc.returncode, proc.stdout, proc.stderr))
|
||||
|
||||
|
||||
class AuditingTests(EmbeddingTestsMixin, unittest.TestCase):
|
||||
def test_open_code_hook(self):
|
||||
self.run_embedded_interpreter("test_open_code_hook")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue