python / python/cpython

Prevent CO_FUTURE_BARRY_AS_BDFL from being applied with PyCF_MASK

Aberta
#123,234 1 comentário 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

interpreter-core type-bug
Linguagem predominante
Python
Estrelas
77.2k
Forks
36k
Métricas de merge de PRs
Métricas de PR pendentes

Descrição

Bug report

Bug description:

When compiling Python strings with the PyCF_MASK, the CO_FUTURE_BARRY_AS_BDFL is included and will be applied to the statement. It would be preferable if the PEP 401 easter egg was not applied to code compiled with the PyCF_MASK compiler flag by default.

Example:

static const char code[] = "1 != 2";
static PyCompilerFlags compiler_flags = { PyCF_MASK | PyCF_SOURCE_IS_UTF8 };
PyObject* n = Py_CompileStringFlags(code, "<string>", Py_single_input, &compiler_flags);

Will result change the result to 1 <> 2.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS, Windows

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

Comece pela definição de CO_FUTURE_BARRY_AS_BDFL em Include/cpython/compile.h e rastreie como Py_CompileStringFlags lida com PyCF_MASK. Reproduza o exemplo em C fornecido no CPython main e, em seguida, adicione ou atualize a cobertura para que PyCF_MASK não aplique mais o comportamento de PEP 401 por padrão.

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

Avaliação

Stack de tecnologia
python
Domínio
compilers
Tipo de issue
Bug
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
45/100

Receba novas issues na sua caixa de entrada

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