]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-148587: Document `sys.lazy_modules` (#150742)
authorBartosz Sławecki <bartosz@ilikepython.com>
Tue, 2 Jun 2026 15:00:45 +0000 (17:00 +0200)
committerGitHub <noreply@github.com>
Tue, 2 Jun 2026 15:00:45 +0000 (16:00 +0100)
Doc/library/sys.rst
Misc/NEWS.d/3.15.0a8.rst
Misc/NEWS.d/next/Core_and_Builtins/2026-05-18-18-36-28.gh-issue-148587.-RD3z5.rst

index 6a4314f1098609df9914498fb0251661183029d4..d0fe0625deb5133683979a4976701b812a3ff93a 100644 (file)
@@ -1481,6 +1481,21 @@ always available. Unless explicitly noted otherwise, all variables are read-only
    They hold the legacy representation of ``sys.last_exc``, as returned
    from :func:`exc_info` above.
 
+
+.. data:: lazy_modules
+
+   A :class:`set` of fully qualified module name strings that have been lazily
+   imported in the current interpreter but not yet loaded.  When a
+   lazily imported module is accessed for the first time, its name is removed
+   from this set.
+
+   This attribute is intended for debugging and introspection.
+
+   See also :func:`set_lazy_imports` and :pep:`810`.
+
+   .. versionadded:: 3.15
+
+
 .. data:: maxsize
 
    An integer giving the maximum value a variable of type :c:type:`Py_ssize_t` can
index eceb9257672c158e51b0c7e6220b55bd08b911f8..28e9ca85166620f72ed2df4e7a4ccbd325920789 100644 (file)
@@ -340,7 +340,7 @@ Fix :func:`repr` for lists and tuples containing ``NULL``\ s.
 .. nonce: aB3xKm
 .. section: Core and Builtins
 
-Fixed ``sys.lazy_modules`` to include lazy modules without submodules. Patch
+Fixed :py:attr:`sys.lazy_modules` to include lazy modules without submodules. Patch
 by Bartosz Sławecki.
 
 ..
index 61bfdcdd37362cd0c1083cf968e90c07ca02ca2e..d623dbdd75f0c8e6537f9a268c28a8b6a31d8ad0 100644 (file)
@@ -1 +1 @@
-``sys.lazy_modules`` is now a set instead of a dict as initially spelled out in PEP 810.
+:py:attr:`sys.lazy_modules` is now a set instead of a dict as initially spelled out in PEP 810.