From 87ef52f7cc23f55a1dcb5a641bf3685dad5026d8 Mon Sep 17 00:00:00 2001 From: Alexandre Teixeira Date: Thu, 29 Oct 2026 08:54:46 +0000 Subject: [PATCH] test: avoid tuple-list allocation in the import-stub guard --- tests/helpers/import_state.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/helpers/import_state.py b/tests/helpers/import_state.py index f58c86c37..deef2dddc 100644 --- a/tests/helpers/import_state.py +++ b/tests/helpers/import_state.py @@ -189,7 +189,7 @@ def bare_module_stubs(): test modules install them on purpose. """ found = set() - for name, mod in list(sys.modules.items()): + for name, mod in sys.modules.copy().items(): if not name.startswith(_GUARDED_PREFIXES): continue if type(mod) is not types.ModuleType: