mirror of
https://github.com/python/cpython.git
synced 2026-05-18 02:15:28 -04:00
bpo-40327: Improve atomicity, speed, and memory efficiency of the items() loop (GH-19628)
This commit is contained in:
committed by
GitHub
parent
d3a8d616fa
commit
75bedbe2ed
+1
-1
@@ -339,7 +339,7 @@ def whichmodule(obj, name):
|
||||
return module_name
|
||||
# Protect the iteration by using a list copy of sys.modules against dynamic
|
||||
# modules that trigger imports of other modules upon calls to getattr.
|
||||
for module_name, module in list(sys.modules.items()):
|
||||
for module_name, module in sys.modules.copy().items():
|
||||
if module_name == '__main__' or module is None:
|
||||
continue
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user