Skip to content

Commit 34e840f

Browse files
authored
GH-66409: check if exec_prefix is the same as prefix before searching executable_dir (#127974)
1 parent 004f9fd commit 34e840f

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
During the :ref:`path initialization <sys-path-init>`, we now check if
2+
``base_exec_prefix`` is the same as ``base_prefix`` before falling back to
3+
searching the Python interpreter directory.

Modules/getpath.py

+2
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,8 @@ def search_up(prefix, *landmarks, test=isfile):
625625
# gh-100320: Our PYDs are assumed to be relative to the Lib directory
626626
# (that is, prefix) rather than the executable (that is, executable_dir)
627627
exec_prefix = prefix
628+
if not exec_prefix and prefix and isdir(joinpath(prefix, PLATSTDLIB_LANDMARK)):
629+
exec_prefix = prefix
628630
if not exec_prefix and executable_dir:
629631
exec_prefix = search_up(executable_dir, PLATSTDLIB_LANDMARK, test=isdir)
630632
if not exec_prefix and EXEC_PREFIX:

0 commit comments

Comments
 (0)