10000 bpo-40327: Improve atomicity, speed, and memory efficiency of the ite… · python/cpython@16d0781 · GitHub
[go: up one dir, main page]

Skip to content

Commit 16d0781

Browse files
bpo-40327: Improve atomicity, speed, and memory efficiency of the items() loop (GH-19628)
(cherry picked from commit 75bedbe) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
1 parent 0714c48 commit 16d0781

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/pickle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def whichmodule(obj, name):
339339
return module_name
340340
# Protect the iteration by using a list copy of sys.modules against dynamic
341341
# modules that trigger imports of other modules upon calls to getattr.
342-
for module_name, module in list(sys.modules.items()):
342+
for module_name, module in sys.modules.copy().items():
343343
if module_name == '__main__' or module is None:
344344
continue
345345
try:

0 commit comments

Comments
 (0)
0