Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 634e53f

Browse files
committed
Fix a bizarre error where test_pickletools fails if preceded by test_pyclbr.
The fix is in neither, but in pickle.py where a loop over sys.modules.items() could modify sys.modules, occasionally.
1 parent 032a284 commit 634e53f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Lib/pickle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ def whichmodule(func, funcname):
791791
if func in classmap:
792792
return classmap[func]
793793

794-
for name, module in sys.modules.items():
794+
for name, module in list(sys.modules.items()):
795795
if module is None:
796796
continue # skip dummy package entries
797797
if name != '__main__' and getattr(module, funcname, None) is func:

0 commit comments

Comments
 (0)