[pypy-svn] r13746 - in pypy/branch/pypy-translation-snapshot: interpreter objspace/std

mwh at codespeak.net mwh at codespeak.net
Thu Jun 23 21:25:26 CEST 2005


Author: mwh
Date: Thu Jun 23 21:25:24 2005
New Revision: 13746

Modified:
   pypy/branch/pypy-translation-snapshot/interpreter/eval.py
   pypy/branch/pypy-translation-snapshot/interpreter/nestedscope.py
   pypy/branch/pypy-translation-snapshot/objspace/std/tupleobject.py
Log:
port zip-removal to translation branch


Modified: pypy/branch/pypy-translation-snapshot/interpreter/eval.py
==============================================================================
--- pypy/branch/pypy-translation-snapshot/interpreter/eval.py	(original)
+++ pypy/branch/pypy-translation-snapshot/interpreter/eval.py	Thu Jun 23 21:25:24 2005
@@ -107,7 +107,10 @@
         if self.w_locals is None:
             self.w_locals = self.space.newdict([])
         varnames = self.code.getvarnames()
-        for name, w_value in zip(varnames, self.getfastscope()):
+        fastscope_w = self.getfastscope()
+        for i in range(min(len(varnames), len(fastscope_w))):
+            name = varnames[i]
+            w_value = fastscope_w[i]
             if w_value is not None:
                 w_name = self.space.wrap(name)
                 self.space.setitem(self.w_locals, w_name, w_value)
@@ -119,7 +122,7 @@
 
         new_fastlocals_w = [None]*self.numlocals
         
-        for name, i in zip(varnames, range(self.numlocals)):
+        for i in range(min(len(varnames), self.numlocals)):
             w_name = self.space.wrap(varnames[i])
             try:
                 w_value = self.space.getitem(self.w_locals, w_name)

Modified: pypy/branch/pypy-translation-snapshot/interpreter/nestedscope.py
==============================================================================
--- pypy/branch/pypy-translation-snapshot/interpreter/nestedscope.py	(original)
+++ pypy/branch/pypy-translation-snapshot/interpreter/nestedscope.py	Thu Jun 23 21:25:24 2005
@@ -73,7 +73,9 @@
         # cellvars are values exported to inner scopes
         # freevars are values coming from outer scopes 
         freevarnames = self.code.co_cellvars + self.code.co_freevars
-        for name, cell in zip(freevarnames, self.cells):
+        for i in range(len(freevarnames)):
+            name = freevarnames[i]
+            cell = self.cells[i]
             try:
                 w_value = cell.get()
             except ValueError:
@@ -85,7 +87,9 @@
     def locals2fast(self):
         PyInterpFrame.locals2fast(self)
         freevarnames = self.code.co_cellvars + self.code.co_freevars
-        for name, cell in zip(freevarnames, self.cells):
+        for i in range(len(freevarnames)):
+            name = freevarnames[i]
+            cell = self.cells[i]
             w_name = self.space.wrap(name)
             try:
                 w_value = self.space.getitem(self.w_locals, w_name)

Modified: pypy/branch/pypy-translation-snapshot/objspace/std/tupleobject.py
==============================================================================
--- pypy/branch/pypy-translation-snapshot/objspace/std/tupleobject.py	(original)
+++ pypy/branch/pypy-translation-snapshot/objspace/std/tupleobject.py	Thu Jun 23 21:25:24 2005
@@ -86,7 +86,9 @@
     items2 = w_tuple2.wrappeditems
     if len(items1) != len(items2):
         return space.w_False
-    for item1, item2 in zip(items1, items2):
+    for i in range(len(items1)):
+        item1 = items1[i]
+        item2 = items2[i]
         if not space.is_true(space.eq(item1, item2)):
             return space.w_False
     return space.w_True



More information about the Pypy-commit mailing list