File tree Expand file tree Collapse file tree 3 files changed +44
-4
lines changed
Expand file tree Collapse file tree 3 files changed +44
-4
lines changed Original file line number Diff line number Diff line change @@ -371,11 +371,20 @@ Importing Modules
371371
372372.. c:type:: PyImport_LazyImportsMode
373373
374- Enumeration of possible lazy import modes:
374+ Enumeration of possible lazy import modes.
375375
376- - :c:enumerator:`PyImport_LAZY_NORMAL`
377- - :c:enumerator:`PyImport_LAZY_ALL`
378- - :c:enumerator:`PyImport_LAZY_NONE`
376+ .. c:enumerator:: PyImport_LAZY_NORMAL
377+
378+ Respect the ``lazy`` keyword in source code. This is the default mode.
379+
380+ .. c:enumerator:: PyImport_LAZY_ALL
381+
382+ Make all imports lazy by default.
383+
384+ .. c:enumerator:: PyImport_LAZY_NONE
385+
386+ Disable lazy imports entirely. Even explicit ``lazy`` statements become
387+ eager imports.
379388
380389 .. versionadded:: next
381390
Original file line number Diff line number Diff line change @@ -343,6 +343,18 @@ Standard names are defined for the following types:
343343 .. seealso :: :pep:`667`
344344
345345
346+ .. data :: LazyImportType
347+
348+ The type of lazy import proxy objects. These objects are created when a
349+ module is lazily imported and serve as placeholders until the module is
350+ actually accessed. This type can be used to detect lazy imports
351+ programmatically.
352+
353+ .. versionadded :: 3.15
354+
355+ .. seealso :: :pep:`810`
356+
357+
346358.. data :: GetSetDescriptorType
347359
348360 The type of objects defined in extension modules with ``PyGetSetDef ``, such
Original file line number Diff line number Diff line change @@ -694,6 +694,14 @@ Miscellaneous options
694694
695695 .. versionadded :: 3.14
696696
697+ * :samp: `-X lazy_imports={ all,none,normal } ` controls lazy import behavior.
698+ ``all `` makes all imports lazy by default, ``none `` disables lazy imports
699+ entirely (even explicit ``lazy `` statements become eager), and ``normal ``
700+ (the default) respects the ``lazy `` keyword in source code.
701+ See also :envvar: `PYTHON_LAZY_IMPORTS `.
702+
703+ .. versionadded :: 3.15
704+
697705 It also allows passing arbitrary values and retrieving them through the
698706 :data: `sys._xoptions ` dictionary.
699707
@@ -1339,6 +1347,17 @@ conflict.
13391347
13401348 .. versionadded :: 3.14
13411349
1350+ .. envvar :: PYTHON_LAZY_IMPORTS
1351+
1352+ Controls lazy import behavior. Accepts three values: ``all `` makes all
1353+ imports lazy by default, ``none `` disables lazy imports entirely (even
1354+ explicit ``lazy `` statements become eager), and ``normal `` (the default)
1355+ respects the ``lazy `` keyword in source code.
1356+
1357+ See also the :option: `-X lazy_imports <-X> ` command-line option.
1358+
1359+ .. versionadded :: 3.15
1360+
13421361Debug-mode variables
13431362~~~~~~~~~~~~~~~~~~~~
13441363
You can’t perform that action at this time.
0 commit comments