gh-100320: Fix path calculations on Windows when python.exe is moved outside of the normal location by zooba · Pull Request #100947 · python/cpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions Lib/test/test_embed.py
20 changes: 12 additions & 8 deletions Lib/test/test_getpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ def test_normal_win32(self):
module_search_paths_set=1,
module_search_paths=[
r"C:\Python\python98.zip",
r"C:\Python\Lib",
r"C:\Python\DLLs",
r"C:\Python\Lib",
r"C:\Python",
],
)
actual = getpath(ns, expected)
Expand All @@ -63,8 +64,8 @@ def test_buildtree_win32(self):
module_search_paths_set=1,
module_search_paths=[
r"C:\CPython\PCbuild\amd64\python98.zip",
r"C:\CPython\Lib",
r"C:\CPython\PCbuild\amd64",
r"C:\CPython\Lib",
],
)
actual = getpath(ns, expected)
Expand Down Expand Up @@ -133,8 +134,9 @@ def test_registry_win32(self):
r"C:\Python\python98.zip",
"path1-dir",
# should not contain not-subdirs
r"C:\Python\Lib",
r"C:\Python\DLLs",
r"C:\Python\Lib",
r"C:\Python",
],
)
actual = getpath(ns, expected)
Expand All @@ -147,8 +149,9 @@ def test_registry_win32(self):
module_search_paths_set=1,
module_search_paths=[
r"C:\Python\python98.zip",
r"C:\Python\Lib",
r"C:\Python\DLLs",
r"C:\Python\Lib",
r"C:\Python",
],
)
actual = getpath(ns, expected)
Expand All @@ -173,8 +176,9 @@ def test_symlink_normal_win32(self):
module_search_paths_set=1,
module_search_paths=[
r"C:\Python\python98.zip",
r"C:\Python\Lib",
r"C:\Python\DLLs",
r"C:\Python\Lib",
r"C:\Python",
],
)
actual = getpath(ns, expected)
Expand All @@ -201,8 +205,8 @@ def test_symlink_buildtree_win32(self):
module_search_paths_set=1,
module_search_paths=[
r"C:\CPython\PCbuild\amd64\python98.zip",
r"C:\CPython\Lib",
r"C:\CPython\PCbuild\amd64",
r"C:\CPython\Lib",
],
)
actual = getpath(ns, expected)
Expand Down Expand Up @@ -231,8 +235,8 @@ def test_buildtree_pythonhome_win32(self):
module_search_paths_set=1,
module_search_paths=[
r"C:\Out\python98.zip",
r"C:\CPython\Lib",
r"C:\Out",
r"C:\CPython\Lib",
],
)
actual = getpath(ns, expected)
Expand All @@ -254,8 +258,8 @@ def test_no_dlls_win32(self):
module_search_paths_set=1,
module_search_paths=[
r"C:\Python\python98.zip",
r"C:\Python\Lib",
r"C:\Python",
r"C:\Python\Lib",
],
)
actual = getpath(ns, expected)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Ensures the ``PythonPath`` registry key from an install is used when
launching from a different copy of Python that relies on an existing install
to provide a copy of its modules and standard library.
48 changes: 30 additions & 18 deletions Modules/getpath.py