From 10ec730825c0c49b669fa67537551c78258060c4 Mon Sep 17 00:00:00 2001 From: Vyron Vasileiadis Date: Thu, 6 Aug 2026 14:46:25 +0300 Subject: [PATCH] gh-155273: Document PyConfig.lazy_imports --- Doc/c-api/init_config.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Doc/c-api/init_config.rst b/Doc/c-api/init_config.rst index ef09639189a6c2..25ca908ce27cc1 100644 --- a/Doc/c-api/init_config.rst +++ b/Doc/c-api/init_config.rst @@ -385,6 +385,10 @@ Configuration Options - :c:member:`isolated ` - ``bool`` - Read-only + * - ``"lazy_imports"`` + - :c:member:`lazy_imports ` + - ``int`` + - Public * - ``"legacy_windows_fs_encoding"`` - :c:member:`legacy_windows_fs_encoding ` - ``bool`` @@ -1578,6 +1582,21 @@ PyConfig See also the :ref:`Isolated Configuration ` and :c:member:`PyPreConfig.isolated`. + .. c:member:: int lazy_imports + + Control :ref:`lazy imports `. + + A value of ``-1`` keeps the default behaviour, where only imports marked + with the ``lazy`` keyword are lazy. A value of ``1`` makes every import + lazy. ``0`` is rejected. + + Configured by the :option:`-X lazy_imports <-X>` command line option or + the :envvar:`PYTHON_LAZY_IMPORTS` environment variable. + + Default: ``-1``. + + .. versionadded:: 3.15 + .. c:member:: int legacy_windows_stdio If non-zero, use :class:`io.FileIO` instead of