python / python/cpython

`PyConfig.lazy_imports` is missing from the C API configuration docs

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

Ninguém assumiu esta issue ainda.

docs topic-C-API topic-lazy-imports
Linguagem predominante
Python
Estrelas
77.2k
Forks
35.9k
Métricas de merge de PRs
Métricas de PR pendentes

Descrição

Documentation

lazy_imports is a PUBLIC entry in PYCONFIG_SPEC (Python/initconfig.c:127) and a member of PyConfig (Include/cpython/initconfig.h:194), so it can be read at runtime. It is the only one of the 25 PUBLIC options with no entry in Doc/c-api/init_config.rst, neither in the Configuration Options list nor as a c:member: of PyConfig.

import ctypes

api = ctypes.pythonapi
api.PyConfig_Get.restype = ctypes.py_object
api.PyConfig_Get.argtypes = [ctypes.c_char_p]

for name in (b"lazy_imports", b"inspect", b"int_max_str_digits"):
    print(name.decode(), "->", api.PyConfig_Get(name))
lazy_imports -> -1
inspect -> False
int_max_str_digits -> 4300

grep -c lazy_imports Doc/c-api/init_config.rst returns 0, while the other two names in that output are both documented there.

PEP 810 (GH-142351) documented the feature elsewhere: -X lazy_imports, PYTHON_LAZY_IMPORTS and the C functions in Doc/c-api/import.rst all landed with it. init_config.rst looks like the file it missed.

The value is a tri-state and that is undocumented too. Python/initconfig.c:1092 says lazy_imports can be -1 (default) or 1 (on), and that 0 is rejected later.

3.15 has the same gap: the spec entry is there and the doc entry is not.

Linked PRs
  • gh-155274
  • gh-155281

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 em Doc/c-api/init_config.rst e compare suas Configuration Options e entradas c:member de PyConfig com Python/initconfig.c:127 e Include/cpython/initconfig.h:194. Verifique Python/initconfig.c:1092 quanto ao comportamento tri-state documentado e, em seguida, confirme que a documentação finalizada abrange lazy_imports e seus valores aceitos.

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

Avaliação

Stack de tecnologia
python
Domínio
documentation
Tipo de issue
Documentação
Dificuldade
2/5
Tempo estimado
1-3 horas
Status de atividade
Estagnada
Clareza
Claramente especificada
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

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