sys._base_executable
in framework builds does not take into account ABI build flag
#124861
Labels
3.13
bugs and security fixes
3.14
bugs and security fixes
OS-mac
topic-venv
Related to the venv module
For 3.13.0, we now provide separate
Python.framework
andPythonT.framework
builds with the python.org macOS installer in an attempt to keep the two installed variants as independent as possible while the free-treading feature is classified as experimental. One goal of this is to ensure that there are no duplicate file names in the two frameworkbin
directories, ending up with i.e.python3.13
in one andpython3.13t
in the other.Unfortunately, it was discovered that removing
python3.13
in thePythonT.framework
bin
directory breaksvenv
support. The root cause is the code that was added toModules/getpath.py
by #31958 which fixed another problem with frameworkvenv
support by settingsys._base_executable
(which venv uses) to:base_executable = f"{dirname(library)}/bin/python{VERSION_MAJOR}.{VERSION_MINOR}"
Note that this path does not take into account the ABI build tag, meaning that any framework builds using a configuration option that appends a non-blank ABI, like
--disable-gil -> t
or--with-pydebug -> d
or both (td
) needs to keep a non-suffixedpython3.x
in its frameworkbin
directory forvenv
executions to work. And that can cause unnoticed ambiguities if users add both frameworkbin
directories to a shellPATH
which could be expected to be a common occurrence.For 3.13.0, we handwave around the problem in the macOS installer by leaving an unsuffixed
python3.13
in thePythonT.framework
bin
directory and by not supporting the free-threaded variant in theUpdate Shell Profile.command
and installer post-installation script. But it should be fixed and, if possible, in a way that does not break existing virtual environments.The text was updated successfully, but these errors were encountered: