[pypy-svn] r58254 - pypy/branch/tuple-nonresizable-395/pypy/interpreter/astcompiler
arigo at codespeak.net
arigo at codespeak.net
Sat Sep 20 12:30:06 CEST 2008
Author: arigo
Date: Sat Sep 20 12:30:05 2008
New Revision: 58254
Modified:
pypy/branch/tuple-nonresizable-395/pypy/interpreter/astcompiler/opt.py
Log:
Don't rely on listcompr here either. That's also a minor clean-up imho.
Modified: pypy/branch/tuple-nonresizable-395/pypy/interpreter/astcompiler/opt.py
==============================================================================
--- pypy/branch/tuple-nonresizable-395/pypy/interpreter/astcompiler/opt.py (original)
+++ pypy/branch/tuple-nonresizable-395/pypy/interpreter/astcompiler/opt.py Sat Sep 20 12:30:05 2008
@@ -231,12 +231,13 @@
return self._visitAbstractTest(node, False)
def visitTuple(self, node):
- for subnode in node.nodes:
+ nodes = node.nodes
+ consts_w = [None] * len(nodes)
+ for i in range(len(nodes)):
+ subnode = nodes[i]
if not isinstance(subnode, ast.Const):
return node # not all constants
- # this isinstance is only to make annotator happier
- consts_w = [subnode.value for subnode in node.nodes
- if isinstance(subnode, ast.Const)]
+ consts_w[i] = subnode.value
return ast.Const(self.space.newtuple(consts_w))
def visitFor(self, node):
More information about the Pypy-commit
mailing list