[pypy-svn] r33166 - pypy/dist/pypy/objspace/std

antocuni at codespeak.net antocuni at codespeak.net
Wed Oct 11 15:08:00 CEST 2006


Author: antocuni
Date: Wed Oct 11 15:07:59 2006
New Revision: 33166

Modified:
   pypy/dist/pypy/objspace/std/dictobject.py
Log:
Put a more informative message instead of letteing the plain
RuntimeError to pass. Note that currently this happens only in
pypy.net, not in pypy-c.



Modified: pypy/dist/pypy/objspace/std/dictobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/dictobject.py	(original)
+++ pypy/dist/pypy/objspace/std/dictobject.py	Wed Oct 11 15:07:59 2006
@@ -274,7 +274,12 @@
             raise OperationError(space.w_RuntimeError,
                      space.wrap("dictionary changed size during iteration"))
         # look for the next entry
-        w_result = w_dictiter.next_entry()
+        try:
+            w_result = w_dictiter.next_entry()
+        except RuntimeError:
+            # it's very likely the underlying dict changed during iteration
+            raise OperationError(space.w_RuntimeError,
+                     space.wrap("dictionary changed during iteration"))
         if w_result is not None:
             w_dictiter.pos += 1
             return w_result



More information about the Pypy-commit mailing list