[pypy-commit] pypy speedup-unpackiterable: I think it's safe that way

fijal noreply at buildbot.pypy.org
Fri Jul 13 02:03:49 CEST 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: speedup-unpackiterable
Changeset: r56055:5cd82fbdcba8
Date: 2012-07-13 02:03 +0200
http://bitbucket.org/pypy/pypy/changeset/5cd82fbdcba8/

Log:	I think it's safe that way

diff --git a/pypy/objspace/std/dictmultiobject.py b/pypy/objspace/std/dictmultiobject.py
--- a/pypy/objspace/std/dictmultiobject.py
+++ b/pypy/objspace/std/dictmultiobject.py
@@ -298,20 +298,15 @@
                 # length of the dict.  The (key, value) pair in 'result'
                 # might be out-of-date.  We try to explicitly look up
                 # the key in the dict.
-                if TP == 'key':
-                    return result[0]
+                if TP == 'key' or TP == 'value':
+                    return result
                 w_key = result[0]
                 w_value = self.dictimplementation.getitem(w_key)
                 if w_value is None:
                     self.len = -1   # Make this error state sticky
                     raise OperationError(self.space.w_RuntimeError,
                         self.space.wrap("dictionary changed during iteration"))
-                if TP == 'value':
-                    return w_value
-                elif TP == 'item':
-                    return (w_key, w_value)
-                else:
-                    assert False # unreachable code
+                return (w_key, w_value)
         # no more entries
         self.dictimplementation = None
         return EMPTY


More information about the pypy-commit mailing list