python / python/cpython

`sys._base_executable` in framework builds does not take into account ABI build flag

Aberta
#124,861 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

3.13 3.14 OS-mac topic-venv
Linguagem predominante
Python
Estrelas
77.2k
Forks
35.9k
Métricas de merge de PRs
Métricas de PR pendentes

Descrição

For 3.13.0, we now provide separate Python.framework and PythonT.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 framework bin directories, ending up with i.e. python3.13 in one and python3.13t in the other.

Unfortunately, it was discovered that removing python3.13 in the PythonT.framework bin directory breaks venv support. The root cause is the code that was added to Modules/getpath.py by #31958 which fixed another problem with framework venv support by setting sys._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-suffixed python3.x in its framework bin directory for venv executions to work. And that can cause unnoticed ambiguities if users add both framework bin directories to a shell PATH 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 the PythonT.framework bin directory and by not supporting the free-threaded variant in the Update 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.

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Leia primeiro Modules/getpath.py e a lógica de caminhos do framework; rastreie como venv consome sys._base_executable. Compare os builds do framework normais e com sufixo ABI e, em seguida, verifique se os ambientes virtuais existentes e os diferentes nomes de bin de Python.framework/PythonT.framework continuam utilizáveis.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
python
Domínio
backend, operating-systems
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
42/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.