python / python/cpython

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

Abierto
#155,273 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

docs topic-C-API topic-lazy-imports
Lenguaje dominante
Python
Estrellas
77.2k
Forks
35.9k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comience en Doc/c-api/init_config.rst y compare sus Configuration Options y entradas c:member de PyConfig con Python/initconfig.c:127 y Include/cpython/initconfig.h:194. Compruebe Python/initconfig.c:1092 para verificar el comportamiento tri-state documentado y, a continuación, verifique que la documentación terminada cubra lazy_imports y sus valores aceptados.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
documentation
Tipo de issue
Documentación
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.