Skip to content

gh-155273: Document PyConfig.lazy_imports - #155281

Merged
ZeroIntensity merged 1 commit into
python:mainfrom
fedonman:doc-pyconfig-lazy-imports
Nov 4, 2026
Merged

ZeroIntensity merged 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

@fedonman

Copy link
Copy Markdown
Contributor Author

@FFY00 Hello, could you please review this?

@fedonman

fedonman commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@ZeroIntensity, could you take a look when you have a moment? It adds the missing PyConfig.lazy_imports entry.

@ZeroIntensity ZeroIntensity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ZeroIntensity ZeroIntensity added the needs backport to 3.15 bugs and security fixes label Nov 4, 2026
@ZeroIntensity
ZeroIntensity merged commit be581b5 into python:main Nov 4, 2026
45 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Nov 4, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @fedonman for the PR, and @ZeroIntensity for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Nov 4, 2026

Copy link
Copy Markdown

GH-161297 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Nov 4, 2026
ZeroIntensity pushed a commit that referenced this pull request Nov 4, 2026
…1297)

(cherry picked from commit be581b5)

Co-authored-by: Vyron Vasileiadis <hi@fedonman.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants