diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2023-10-02 13:59:05 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-02 19:59:05 +0000 |
commit | a040a32ea2f13f16172394d3e3e3f80f47f25a68 (patch) | |
tree | 35048792d20e773569686cdcfe06de881f823b2d /Python/initconfig.c | |
parent | fc2cb86d210555d509debaeefd370d5331cd9d93 (diff) | |
download | cpython-a040a32ea2f13f16172394d3e3e3f80f47f25a68.tar.gz cpython-a040a32ea2f13f16172394d3e3e3f80f47f25a68.zip |
gh-109853: Fix sys.path[0] For Subinterpreters (gh-109994)
This change makes sure sys.path[0] is set properly for subinterpreters. Before, it wasn't getting set at all. This PR does not address the broader concerns from gh-109853.
Diffstat (limited to 'Python/initconfig.c')
-rw-r--r-- | Python/initconfig.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/initconfig.c b/Python/initconfig.c index 089ede4623e..6b76b4dc681 100644 --- a/Python/initconfig.c +++ b/Python/initconfig.c @@ -97,6 +97,7 @@ static const PyConfigSpec PYCONFIG_SPEC[] = { SPEC(pythonpath_env, WSTR_OPT), SPEC(home, WSTR_OPT), SPEC(platlibdir, WSTR), + SPEC(sys_path_0, WSTR_OPT), SPEC(module_search_paths_set, UINT), SPEC(module_search_paths, WSTR_LIST), SPEC(stdlib_dir, WSTR_OPT), @@ -770,6 +771,7 @@ PyConfig_Clear(PyConfig *config) CLEAR(config->exec_prefix); CLEAR(config->base_exec_prefix); CLEAR(config->platlibdir); + CLEAR(config->sys_path_0); CLEAR(config->filesystem_encoding); CLEAR(config->filesystem_errors); @@ -3051,6 +3053,7 @@ _Py_DumpPathConfig(PyThreadState *tstate) PySys_WriteStderr(" import site = %i\n", config->site_import); PySys_WriteStderr(" is in build tree = %i\n", config->_is_python_build); DUMP_CONFIG("stdlib dir", stdlib_dir); + DUMP_CONFIG("sys.path[0]", sys_path_0); #undef DUMP_CONFIG #define DUMP_SYS(NAME) \ |