]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix a bizarre error where test_pickletools fails if preceded by test_pyclbr.
authorGuido van Rossum <guido@python.org>
Mon, 26 Feb 2007 07:07:02 +0000 (07:07 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 26 Feb 2007 07:07:02 +0000 (07:07 +0000)
The fix is in neither, but in pickle.py where a loop over sys.modules.items()
could modify sys.modules, occasionally.

Lib/pickle.py

index db7f5124e5878c66f88cac71f0c781e8f926ae3a..3d2ebd26e4a60c42cca356f53bd76f569e0ea632 100644 (file)
@@ -791,7 +791,7 @@ def whichmodule(func, funcname):
     if func in classmap:
         return classmap[func]
 
-    for name, module in sys.modules.items():
+    for name, module in list(sys.modules.items()):
         if module is None:
             continue # skip dummy package entries
         if name != '__main__' and getattr(module, funcname, None) is func: