Skip to content

Commit

Permalink
pythonGH-66409: check if exec_prefix is the same as prefix before sea…
Browse files Browse the repository at this point in the history
…rching executable_dir (python#127974)
  • Loading branch information
FFY00 authored Jan 8, 2025
1 parent 004f9fd commit 34e840f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions Modules/getpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 34e840f

Please sign in to comment.