Skip to content

Commit accc0c8

Browse files
[3.15] gh-148587: Document sys.lazy_modules (GH-150742)
(cherry picked from commit e3fa52d) Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
1 parent 53e7f24 commit accc0c8

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

Doc/library/sys.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,6 +1483,21 @@ always available. Unless explicitly noted otherwise, all variables are read-only
14831483
They hold the legacy representation of ``sys.last_exc``, as returned
14841484
from :func:`exc_info` above.
14851485

1486+
1487+
.. data:: lazy_modules
1488+
1489+
A :class:`set` of fully qualified module name strings that have been lazily
1490+
imported in the current interpreter but not yet loaded. When a
1491+
lazily imported module is accessed for the first time, its name is removed
1492+
from this set.
1493+
1494+
This attribute is intended for debugging and introspection.
1495+
1496+
See also :func:`set_lazy_imports` and :pep:`810`.
1497+
1498+
.. versionadded:: 3.15
1499+
1500+
14861501
.. data:: maxsize
14871502

14881503
An integer giving the maximum value a variable of type :c:type:`Py_ssize_t` can

Misc/NEWS.d/3.15.0a8.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ Fix :func:`repr` for lists and tuples containing ``NULL``\ s.
350350
.. nonce: aB3xKm
351351
.. section: Core and Builtins
352352
353-
Fixed ``sys.lazy_modules`` to include lazy modules without submodules. Patch
353+
Fixed :py:attr:`sys.lazy_modules` to include lazy modules without submodules. Patch
354354
by Bartosz Sławecki.
355355

356356
..

Misc/NEWS.d/3.15.0b2.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function call.
132132
.. nonce: -RD3z5
133133
.. section: Core and Builtins
134134
135-
``sys.lazy_modules`` is now a set instead of a dict as initially spelled out
135+
:py:attr:`sys.lazy_modules` is now a set instead of a dict as initially spelled out
136136
in PEP 810.
137137

138138
..

0 commit comments

Comments
 (0)