]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.15] gh-148587: Document `sys.lazy_modules` (GH-150742)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 3 Jun 2026 08:36:50 +0000 (10:36 +0200)
committerGitHub <noreply@github.com>
Wed, 3 Jun 2026 08:36:50 +0000 (09:36 +0100)
(cherry picked from commit e3fa52d953492772d36f5a4397262483bcf67641)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Doc/library/sys.rst
Misc/NEWS.d/3.15.0a8.rst
Misc/NEWS.d/3.15.0b2.rst

index 6946eb6eeaa5fae0e737973dda004fd06b8d7326..4683fc03f843a2770765ddcfda5844a99f12d410 100644 (file)
@@ -1483,6 +1483,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 ff7930aeb292d671767f86a408c72a329399b0af..3c6da8b6ab48e31cfe766b8d981b178c5bb2e78a 100644 (file)
@@ -350,7 +350,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 24fef1907d5122c52d4f4abc9e26c149b2bd1ab2..afbdd4e072ed7d44d0c5872310eddf7a816e5085 100644 (file)
@@ -132,7 +132,7 @@ function call.
 .. nonce: -RD3z5
 .. section: Core and Builtins
 
-``sys.lazy_modules`` is now a set instead of a dict as initially spelled out
+:py:attr:`sys.lazy_modules` is now a set instead of a dict as initially spelled out
 in PEP 810.
 
 ..