python / python/cpython

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

Ouverte
#155,273 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

docs topic-C-API topic-lazy-imports
Langage dominant
Python
Étoiles
77.2k
Forks
35.9k
Métriques de merge des PR
Métriques de PR en attente

Description

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez dans Doc/c-api/init_config.rst et comparez ses Configuration Options et ses entrées c:member de PyConfig avec Python/initconfig.c:127 et Include/cpython/initconfig.h:194. Consultez Python/initconfig.c:1092 pour vérifier le comportement tri-state documenté, puis vérifiez que la documentation finalisée couvre lazy_imports et ses valeurs acceptées.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
documentation
Type d'issue
Documentation
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.