[pypy-svn] r66554 - pypy/branch/parser-compiler/pypy/interpreter/astcompiler

benjamin at codespeak.net benjamin at codespeak.net
Thu Jul 23 20:05:20 CEST 2009


Author: benjamin
Date: Thu Jul 23 20:05:19 2009
New Revision: 66554

Modified:
   pypy/branch/parser-compiler/pypy/interpreter/astcompiler/optimize.py
Log:
don't resize list

Modified: pypy/branch/parser-compiler/pypy/interpreter/astcompiler/optimize.py
==============================================================================
--- pypy/branch/parser-compiler/pypy/interpreter/astcompiler/optimize.py	(original)
+++ pypy/branch/parser-compiler/pypy/interpreter/astcompiler/optimize.py	Thu Jul 23 20:05:19 2009
@@ -238,12 +238,15 @@
         return name
 
     def visit_Tuple(self, tup):
-        consts_w = []
         if tup.elts:
-            for node in tup.elts:
+            consts_w = []*len(tup.elts)
+            for i in range(len(tup.elts)):
+                node = tup.elts[i]
                 w_const = node.as_constant()
                 if w_const is None:
                     return tup
-                consts_w.append(w_const)
+                consts_w[i] = node
+        else:
+            consts_w = []
         w_consts = self.space.newtuple(consts_w)
         return ast.Const(w_consts, tup.lineno, tup.col_offset)



More information about the Pypy-commit mailing list