@@ -479,6 +479,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
479479 '_init_main' : 1 ,
480480 '_isolated_interpreter' : 0 ,
481481 'use_frozen_modules' : not Py_DEBUG ,
482+ 'safe_path' : 0 ,
482483 '_is_python_build' : IGNORE_CONFIG ,
483484 }
484485 if MS_WINDOWS :
@@ -496,6 +497,7 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
496497 isolated = 1 ,
497498 use_environment = 0 ,
498499 user_site_directory = 0 ,
500+ safe_path = 1 ,
499501 dev_mode = 0 ,
500502 install_signal_handlers = 0 ,
501503 use_hash_seed = 0 ,
@@ -855,6 +857,7 @@ def test_init_from_config(self):
855857 'faulthandler' : 1 ,
856858 'platlibdir' : 'my_platlibdir' ,
857859 'module_search_paths' : self .IGNORE_CONFIG ,
860+ 'safe_path' : 1 ,
858861
859862 'check_hash_pycs_mode' : 'always' ,
860863 'pathconfig_warnings' : 0 ,
@@ -889,6 +892,7 @@ def test_init_compat_env(self):
889892 'warnoptions' : ['EnvVar' ],
890893 'platlibdir' : 'env_platlibdir' ,
891894 'module_search_paths' : self .IGNORE_CONFIG ,
895+ 'safe_path' : 1 ,
892896 }
893897 self .check_all_configs ("test_init_compat_env" , config , preconfig ,
894898 api = API_COMPAT )
@@ -919,6 +923,7 @@ def test_init_python_env(self):
919923 'warnoptions' : ['EnvVar' ],
920924 'platlibdir' : 'env_platlibdir' ,
921925 'module_search_paths' : self .IGNORE_CONFIG ,
926+ 'safe_path' : 1 ,
922927 }
923928 self .check_all_configs ("test_init_python_env" , config , preconfig ,
924929 api = API_PYTHON )
@@ -959,12 +964,13 @@ def test_preinit_parse_argv(self):
959964 }
960965 config = {
961966 'argv' : ['script.py' ],
962- 'orig_argv' : ['python3' , '-X' , 'dev' , 'script.py' ],
967+ 'orig_argv' : ['python3' , '-X' , 'dev' , '-P' , ' script.py' ],
963968 'run_filename' : os .path .abspath ('script.py' ),
964969 'dev_mode' : 1 ,
965970 'faulthandler' : 1 ,
966971 'warnoptions' : ['default' ],
967972 'xoptions' : ['dev' ],
973+ 'safe_path' : 1 ,
968974 }
969975 self .check_all_configs ("test_preinit_parse_argv" , config , preconfig ,
970976 api = API_PYTHON )
@@ -975,7 +981,7 @@ def test_preinit_dont_parse_argv(self):
975981 'isolated' : 0 ,
976982 }
977983 argv = ["python3" ,
978- "-E" , "-I" ,
984+ "-E" , "-I" , "-P" ,
979985 "-X" , "dev" ,
980986 "-X" , "utf8" ,
981987 "script.py" ]
@@ -990,6 +996,7 @@ def test_preinit_dont_parse_argv(self):
990996 def test_init_isolated_flag (self ):
991997 config = {
992998 'isolated' : 1 ,
999+ 'safe_path' : 1 ,
9931000 'use_environment' : 0 ,
9941001 'user_site_directory' : 0 ,
9951002 }
@@ -999,6 +1006,7 @@ def test_preinit_isolated1(self):
9991006 # _PyPreConfig.isolated=1, _PyCoreConfig.isolated not set
10001007 config = {
10011008 'isolated' : 1 ,
1009+ 'safe_path' : 1 ,
10021010 'use_environment' : 0 ,
10031011 'user_site_directory' : 0 ,
10041012 }
@@ -1008,6 +1016,7 @@ def test_preinit_isolated2(self):
10081016 # _PyPreConfig.isolated=0, _PyCoreConfig.isolated=1
10091017 config = {
10101018 'isolated' : 1 ,
1019+ 'safe_path' : 1 ,
10111020 'use_environment' : 0 ,
10121021 'user_site_directory' : 0 ,
10131022 }
0 commit comments