diff options
author | Victor Stinner <vstinner@redhat.com> | 2018-11-16 10:55:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-16 10:55:35 (GMT) |
commit | 37cd982df02795905886ab36a2378ed557cb6f60 (patch) | |
tree | aa750eca7acb660a0d3156fd7820396c2dff2f4c /Lib | |
parent | b65413b497a07f521d835b799be7dd0afcedbd65 (diff) | |
download | cpython-37cd982df02795905886ab36a2378ed557cb6f60.zip cpython-37cd982df02795905886ab36a2378ed557cb6f60.tar.gz cpython-37cd982df02795905886ab36a2378ed557cb6f60.tar.bz2 |
bpo-35239: _PySys_EndInit() copies module_search_path (GH-10532)
* The _PySys_EndInit() function now copies the
config->module_search_path list, so config is longer modified when
sys.path is updated.
* config->warnoptions list and config->xoptions dict are also copied
* test_embed: InitConfigTests now also tests
main_config['module_search_path']
* Fix _Py_InitializeMainInterpreter(): don't use config->warnoptions
but sys.warnoptions to decide if the warnings module should
be imported at startup.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_embed.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index 75e31c2..3f383d7 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -331,10 +331,6 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): }) # main config - UNTESTED_MAIN_CONFIG = ( - # FIXME: untested main configuration variables - 'module_search_path', - ) COPY_MAIN_CONFIG = ( # Copy core config to main config for expected values 'argv', @@ -346,7 +342,8 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): 'prefix', 'pycache_prefix', 'warnoptions', - # xoptions is created from core_config in check_main_config() + # xoptions is created from core_config in check_main_config(). + # 'module_search_paths' is copied to 'module_search_path'. ) # global config @@ -426,12 +423,10 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): main_config = config['main_config'] # main config - for key in self.UNTESTED_MAIN_CONFIG: - del main_config[key] - expected_main = {} for key in self.COPY_MAIN_CONFIG: expected_main[key] = core_config[key] + expected_main['module_search_path'] = core_config['module_search_paths'] expected_main['xoptions'] = self.main_xoptions(core_config['xoptions']) self.assertEqual(main_config, expected_main) |