Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
gh-148587: Trim sys.lazy_modules contract test and NEWS
Drop test_lazy_modules_is_immutable; the frozendict assertion already
covers immutability. Trim the trailing sentence in the NEWS entry that
restated the same contract.
  • Loading branch information
johnslavik committed May 5, 2026
commit 0424a64806a0eb2c2ed31a85d7faf204dd4c6401
8 changes: 0 additions & 8 deletions Lib/test/test_lazy_import/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,14 +499,6 @@ def test_lazy_modules_returns_fresh_mapping(self):
self.assertIsNot(first, second)
self.assertEqual(first, second)

def test_lazy_modules_is_immutable(self):
"""Mutation through sys.lazy_modules must not be possible."""
snapshot = sys.lazy_modules
with self.assertRaises(TypeError):
snapshot["foo"] = frozenset()
with self.assertRaises(AttributeError):
snapshot.clear()

def test_underscore_lazy_modules_is_live_dict(self):
"""sys._lazy_modules should be the live, mutable registry."""
registry = sys._lazy_modules
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
:data:`sys.lazy_modules` is now a read-only :class:`frozendict` mapping
each module's fully qualified name to the :class:`frozenset` of its
lazily-imported submodule names, instead of a live mutable :class:`dict`
of :class:`set` objects. User code can no longer mutate the lazy import
registry through this attribute.
of :class:`set` objects.