FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-45471: Do not set _Py_path_config.stdlib_dir in Py_SetPythonHome(). by ericsnowcurrently · Pull Request #28954 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) .py  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
7 changes: 6 additions & 1 deletion Lib/test/test_embed.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,11 @@ def test_init_setpythonhome(self):
self.fail(f"Unable to find home in {paths!r}")

prefix = exec_prefix = home
if MS_WINDOWS:
stdlib = os.path.join(home, sys.platlibdir)
else:
version = f'{sys.version_info.major}.{sys.version_info.minor}'
stdlib = os.path.join(home, sys.platlibdir, f'python{version}')
expected_paths = self.module_search_paths(prefix=home, exec_prefix=home)

config = {
Expand All @@ -1257,7 +1262,7 @@ def test_init_setpythonhome(self):
'exec_prefix': exec_prefix,
'base_exec_prefix': exec_prefix,
'pythonpath_env': paths_str,
'stdlib_dir': home,
'stdlib_dir': stdlib,
}
self.default_program_name(config)
env = {'TESTHOME': home, 'PYTHONPATH': paths_str}
Expand Down
5 changes: 1 addition & 4 deletions Python/pathconfig.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -530,13 +530,10 @@ Py_SetPythonHome(const wchar_t *home)

PyMem_RawFree(_Py_path_config.home);
_Py_path_config.home = _PyMem_RawWcsdup(home);
if (_Py_path_config.home != NULL) {
_Py_path_config.stdlib_dir = _PyMem_RawWcsdup(home);
}

PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);

if (_Py_path_config.home == NULL || _Py_path_config.stdlib_dir == NULL) {
if (_Py_path_config.home == NULL) {
path_out_of_memory(__func__);
}
}
Expand Down

Back | FazBrowse Home | New Git URL