]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-66409: check if exec_prefix is the same as prefix before searching executable_dir...
authorFilipe Laíns 🇵🇸 <lains@riseup.net>
Wed, 8 Jan 2025 20:23:16 +0000 (20:23 +0000)
committerGitHub <noreply@github.com>
Wed, 8 Jan 2025 20:23:16 +0000 (20:23 +0000)
Misc/NEWS.d/next/Core_and_Builtins/2024-12-15-21-11-26.gh-issue-66409.wv109z.rst [new file with mode: 0644]
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 (file)
index 0000000..0d70ad0
--- /dev/null
@@ -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.
index c34101e720851d915dae95ef2e92b3b9f63a4f9a..be2210345afbda5645a3a54ad93e1211fb5b6a46 100644 (file)
@@ -625,6 +625,8 @@ else:
             # 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: