[pypy-svn] r67405 - in pypy/trunk/pypy: interpreter objspace/flow

arigo at codespeak.net arigo at codespeak.net
Tue Sep 1 17:05:53 CEST 2009


Author: arigo
Date: Tue Sep  1 17:05:53 2009
New Revision: 67405

Modified:
   pypy/trunk/pypy/interpreter/pyframe.py
   pypy/trunk/pypy/interpreter/pyopcode.py
   pypy/trunk/pypy/objspace/flow/objspace.py
Log:
Replace space.unpackiterable() in UNPACK_SEQUENCE with
space.viewiterable().  Fix in the flow space.


Modified: pypy/trunk/pypy/interpreter/pyframe.py
==============================================================================
--- pypy/trunk/pypy/interpreter/pyframe.py	(original)
+++ pypy/trunk/pypy/interpreter/pyframe.py	Tue Sep  1 17:05:53 2009
@@ -202,6 +202,7 @@
         self.valuestackdepth = finaldepth
 
     def pushrevvalues(self, n, values_w): # n should be len(values_w)
+        make_sure_not_resized(values_w)
         while True:
             n -= 1
             if n < 0:

Modified: pypy/trunk/pypy/interpreter/pyopcode.py
==============================================================================
--- pypy/trunk/pypy/interpreter/pyopcode.py	(original)
+++ pypy/trunk/pypy/interpreter/pyopcode.py	Tue Sep  1 17:05:53 2009
@@ -636,7 +636,7 @@
     def UNPACK_SEQUENCE(f, itemcount, *ignored):
         w_iterable = f.popvalue()
         try:
-            items = f.space.unpackiterable(w_iterable, itemcount)
+            items = f.space.viewiterable(w_iterable, itemcount)
         except UnpackValueError, e:
             raise OperationError(f.space.w_ValueError, f.space.wrap(e.msg))
         f.pushrevvalues(itemcount, items)

Modified: pypy/trunk/pypy/objspace/flow/objspace.py
==============================================================================
--- pypy/trunk/pypy/objspace/flow/objspace.py	(original)
+++ pypy/trunk/pypy/objspace/flow/objspace.py	Tue Sep  1 17:05:53 2009
@@ -264,12 +264,7 @@
         return graph
 
     def viewiterable(self, w_tuple, expected_length=None):
-        unwrapped = self.unwrap(w_tuple)
-        result = tuple([Constant(x) for x in unwrapped])
-        if expected_length is not None and len(result) != expected_length:
-            raise ValueError, "got a tuple of length %d instead of %d" % (
-                len(result), expected_length)
-        return result
+        return self.unpackiterable(w_tuple, expected_length)
 
     def unpackiterable(self, w_iterable, expected_length=None):
         if not isinstance(w_iterable, Variable):



More information about the Pypy-commit mailing list