test: avoid tuple-list allocation in the import-stub guard

This commit is contained in:
Alexandre Teixeira
2026-10-29 08:54:46 +00:00
parent 5bf4524618
commit 87ef52f7cc
+1 -1
View File
@@ -189,7 +189,7 @@ def bare_module_stubs():
test modules install them on purpose. test modules install them on purpose.
""" """
found = set() found = set()
for name, mod in list(sys.modules.items()): for name, mod in sys.modules.copy().items():
if not name.startswith(_GUARDED_PREFIXES): if not name.startswith(_GUARDED_PREFIXES):
continue continue
if type(mod) is not types.ModuleType: if type(mod) is not types.ModuleType: