Skip to content

gh-155273: Document PyConfig.lazy_imports - #155281

Open
fedonman wants to merge 1 commit into
python:mainfrom
fedonman:doc-pyconfig-lazy-imports
Open

gh-155273: Document PyConfig.lazy_imports#155281
fedonman wants to merge 1 commit into
python:mainfrom
fedonman:doc-pyconfig-lazy-imports

Conversation

@fedonman

@fedonman fedonman commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

lazy_imports is a PUBLIC entry in PYCONFIG_SPEC (Python/initconfig.c:127) and a
member of PyConfig (Include/cpython/initconfig.h:194), but it was the only one of the
25 PUBLIC options with no entry in this file. PEP 810 documented the feature in
Doc/c-api/import.rst, Doc/using/cmdline.rst and the whatsnew, and missed this one.

This adds the row to the Configuration Options table and the c:member: block, both in
their alphabetical place, and documents the tri-state: -1 is the default and respects
the lazy keyword, 1 makes every import lazy, 0 is rejected
(Python/initconfig.c:1092, and the default is set at :1206).

I could not build the docs here: this environment has no sphinx-build, no sphinx-lint
and no pip. Instead I checked that every target used already resolves in the tree
(_lazy-imports: in Doc/reference/simple_stmts.rst, .. envvar:: PYTHON_LAZY_IMPORTS
in Doc/using/cmdline.rst), and copied the :option:-X ... <-X>`` form and the row
layout from the neighbouring entries. The readthedocs preview build on this PR is the
real check.

3.15 has the same gap, so this looks like a backport candidate.

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33944666 | 📁 Comparing 10ec730 against main (9cbb9e5)

  🔍 Preview build  

1 file changed
± c-api/init_config.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants