https://github.com/python/cpython/commit/34e840f9ddd9c04991cf004e2594c6a1e0e278d3
commit: 34e840f9ddd9c04991cf004e2594c6a1e0e278d3
branch: main
author: Filipe Laíns 🇵🇸 <[email protected]>
committer: FFY00 <[email protected]>
date: 2025-01-08T20:23:16Z
summary:
GH-66409: check if exec_prefix is the same as prefix before searching
executable_dir (#127974)
files:
A
Misc/NEWS.d/next/Core_and_Builtins/2024-12-15-21-11-26.gh-issue-66409.wv109z.rst
M Modules/getpath.py
diff --git
a/Misc/NEWS.d/next/Core_and_Builtins/2024-12-15-21-11-26.gh-issue-66409.wv109z.rst
b/Misc/NEWS.d/next/Core_and_Builtins/2024-12-15-21-11-26.gh-issue-66409.wv109z.rst
new file mode 100644
index 00000000000000..0d70ad06c97968
--- /dev/null
+++
b/Misc/NEWS.d/next/Core_and_Builtins/2024-12-15-21-11-26.gh-issue-66409.wv109z.rst
@@ -0,0 +1,3 @@
+During the :ref:`path initialization <sys-path-init>`, we now check if
+``base_exec_prefix`` is the same as ``base_prefix`` before falling back to
+searching the Python interpreter directory.
diff --git a/Modules/getpath.py b/Modules/getpath.py
index c34101e720851d..be2210345afbda 100644
--- a/Modules/getpath.py
+++ b/Modules/getpath.py
@@ -625,6 +625,8 @@ def search_up(prefix, *landmarks, test=isfile):
# gh-100320: Our PYDs are assumed to be relative to the Lib
directory
# (that is, prefix) rather than the executable (that is,
executable_dir)
exec_prefix = prefix
+ if not exec_prefix and prefix and isdir(joinpath(prefix,
PLATSTDLIB_LANDMARK)):
+ exec_prefix = prefix
if not exec_prefix and executable_dir:
exec_prefix = search_up(executable_dir, PLATSTDLIB_LANDMARK,
test=isdir)
if not exec_prefix and EXEC_PREFIX:
_______________________________________________
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]