https://github.com/python/cpython/commit/e3fa52d953492772d36f5a4397262483bcf67641
commit: e3fa52d953492772d36f5a4397262483bcf67641
branch: main
author: Bartosz Sławecki <[email protected]>
committer: pablogsal <[email protected]>
date: 2026-06-02T16:00:45+01:00
summary:
gh-148587: Document `sys.lazy_modules` (#150742)
files:
M Doc/library/sys.rst
M Misc/NEWS.d/3.15.0a8.rst
M
Misc/NEWS.d/next/Core_and_Builtins/2026-05-18-18-36-28.gh-issue-148587.-RD3z5.rst
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index 6a4314f1098609..d0fe0625deb513 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -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
diff --git a/Misc/NEWS.d/3.15.0a8.rst b/Misc/NEWS.d/3.15.0a8.rst
index eceb9257672c15..28e9ca85166620 100644
--- a/Misc/NEWS.d/3.15.0a8.rst
+++ b/Misc/NEWS.d/3.15.0a8.rst
@@ -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.
..
diff --git
a/Misc/NEWS.d/next/Core_and_Builtins/2026-05-18-18-36-28.gh-issue-148587.-RD3z5.rst
b/Misc/NEWS.d/next/Core_and_Builtins/2026-05-18-18-36-28.gh-issue-148587.-RD3z5.rst
index 61bfdcdd37362c..d623dbdd75f0c8 100644
---
a/Misc/NEWS.d/next/Core_and_Builtins/2026-05-18-18-36-28.gh-issue-148587.-RD3z5.rst
+++
b/Misc/NEWS.d/next/Core_and_Builtins/2026-05-18-18-36-28.gh-issue-148587.-RD3z5.rst
@@ -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.
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]