python / python/cpython

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

Offen
#155,273 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

docs topic-C-API topic-lazy-imports
Vorherrschende Sprache
Python
Sterne
77.2k
Forks
35.9k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie in Doc/c-api/init_config.rst und vergleichen Sie dessen Configuration Options und PyConfig c:member-Einträge mit Python/initconfig.c:127 und Include/cpython/initconfig.h:194. Prüfen Sie Python/initconfig.c:1092 auf das dokumentierte tri-state-Verhalten und verifizieren Sie anschließend, dass die fertige Dokumentation lazy_imports und dessen zulässige Werte abdeckt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.