https://github.com/python/cpython/commit/6826ebf9866b860367e4763b3e4651950614c5aa
commit: 6826ebf9866b860367e4763b3e4651950614c5aa
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2025-10-02T16:52:10+02:00
summary:

gh-89745: Remove test_embed.test_init_read_set() (#139500)

Since Python 3.11, it's no longer possible to call PyConfig_Read() to
get the path configuration, and then modify the path configuration.

files:
M Lib/test/test_embed.py
M Programs/_testembed.c

diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py
index 22dfdb6bb6f138..1933f691a78be5 100644
--- a/Lib/test/test_embed.py
+++ b/Lib/test/test_embed.py
@@ -1232,21 +1232,6 @@ def test_init_dont_configure_locale(self):
         self.check_all_configs("test_init_dont_configure_locale", {}, 
preconfig,
                                api=API_PYTHON)
 
-    @unittest.skip('as of 3.11 this test no longer works because '
-                   'path calculations do not occur on read')
-    def test_init_read_set(self):
-        config = {
-            'program_name': './init_read_set',
-            'executable': 'my_executable',
-            'base_executable': 'my_executable',
-        }
-        def modify_path(path):
-            path.insert(1, "test_path_insert1")
-            path.append("test_path_append")
-        self.check_all_configs("test_init_read_set", config,
-                               api=API_PYTHON,
-                               modify_path_cb=modify_path)
-
     def test_init_sys_add(self):
         config = {
             'faulthandler': 1,
diff --git a/Programs/_testembed.c b/Programs/_testembed.c
index 76c61efeb50a75..d3600fecbe2775 100644
--- a/Programs/_testembed.c
+++ b/Programs/_testembed.c
@@ -1506,44 +1506,6 @@ static int test_audit_run_stdin(void)
     return run_audit_run_test(Py_ARRAY_LENGTH(argv), argv, &test);
 }
 
-static int test_init_read_set(void)
-{
-    PyStatus status;
-    PyConfig config;
-    PyConfig_InitPythonConfig(&config);
-
-    config_set_string(&config, &config.program_name, L"./init_read_set");
-
-    status = PyConfig_Read(&config);
-    if (PyStatus_Exception(status)) {
-        goto fail;
-    }
-
-    status = PyWideStringList_Insert(&config.module_search_paths,
-                                     1, L"test_path_insert1");
-    if (PyStatus_Exception(status)) {
-        goto fail;
-    }
-
-    status = PyWideStringList_Append(&config.module_search_paths,
-                                     L"test_path_append");
-    if (PyStatus_Exception(status)) {
-        goto fail;
-    }
-
-    /* override executable computed by PyConfig_Read() */
-    config_set_string(&config, &config.executable, L"my_executable");
-    init_from_config_clear(&config);
-
-    dump_config();
-    Py_Finalize();
-    return 0;
-
-fail:
-    PyConfig_Clear(&config);
-    Py_ExitStatusException(status);
-}
-
 
 static int test_init_sys_add(void)
 {
@@ -2398,7 +2360,6 @@ static struct TestCase TestCases[] = {
     {"test_preinit_isolated2", test_preinit_isolated2},
     {"test_preinit_parse_argv", test_preinit_parse_argv},
     {"test_preinit_dont_parse_argv", test_preinit_dont_parse_argv},
-    {"test_init_read_set", test_init_read_set},
     {"test_init_run_main", test_init_run_main},
     {"test_init_sys_add", test_init_sys_add},
     {"test_init_setpath", test_init_setpath},

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to