[pypy-svn] r17339 - in pypy/dist/pypy: interpreter/astcompiler module/__builtin__/test/impsubdir/compiled
pedronis at codespeak.net
pedronis at codespeak.net
Wed Sep 7 19:59:41 CEST 2005
Author: pedronis
Date: Wed Sep 7 19:59:39 2005
New Revision: 17339
Modified:
pypy/dist/pypy/interpreter/astcompiler/pyassem.py
pypy/dist/pypy/interpreter/astcompiler/pycodegen.py
pypy/dist/pypy/module/__builtin__/test/impsubdir/compiled/x.pyc
Log:
fix some mixing of () and lists through defaults
call directly and isolate visit functions with return values
Modified: pypy/dist/pypy/interpreter/astcompiler/pyassem.py
==============================================================================
--- pypy/dist/pypy/interpreter/astcompiler/pyassem.py (original)
+++ pypy/dist/pypy/interpreter/astcompiler/pyassem.py Wed Sep 7 19:59:39 2005
@@ -420,8 +420,10 @@
class PyFlowGraph(FlowGraph):
- def __init__(self, space, name, filename, args=(), optimized=0, klass=0):
+ def __init__(self, space, name, filename, args=None, optimized=0, klass=0):
FlowGraph.__init__(self, space)
+ if args is None:
+ args = []
self.name = name
self.filename = filename
self.docstring = space.w_None
Modified: pypy/dist/pypy/interpreter/astcompiler/pycodegen.py
==============================================================================
--- pypy/dist/pypy/interpreter/astcompiler/pycodegen.py (original)
+++ pypy/dist/pypy/interpreter/astcompiler/pycodegen.py Wed Sep 7 19:59:39 2005
@@ -130,7 +130,7 @@
class LocalNameFinder(ast.ASTVisitor):
"""Find local names in scope"""
- def __init__(self, names=()):
+ def __init__(self, names=[]):
self.names = misc.Set()
self.globals = misc.Set()
for name in names:
@@ -600,7 +600,7 @@
stack = []
for i, for_ in zip(range(len(node.quals)), node.quals):
- start, anchor = for_.accept( self )
+ start, anchor = self._visitListCompFor(for_)
self.genexpr_cont_stack.append( None )
for if_ in for_.ifs:
if self.genexpr_cont_stack[-1] is None:
@@ -627,7 +627,8 @@
self.__list_count = self.__list_count - 1
- def visitListCompFor(self, node):
+ def _visitListCompFor(self, node):
+ assert isinstance(node, ast.ListCompFor)
start = self.newBlock()
anchor = self.newBlock()
@@ -675,7 +676,7 @@
stack = []
for i, for_ in zip(range(len(node.quals)), node.quals):
- start, anchor = for_.accept( self )
+ start, anchor = self._visitGenExprFor(for_)
self.genexpr_cont_stack.append( None )
for if_ in for_.ifs:
if self.genexpr_cont_stack[-1] is None:
@@ -698,7 +699,8 @@
self.startBlock(anchor)
self.emitop_obj('LOAD_CONST', self.space.w_None)
- def visitGenExprFor(self, node):
+ def _visitGenExprFor(self, node):
+ assert isinstance(node, ast.GenExprFor)
start = self.newBlock()
anchor = self.newBlock()
Modified: pypy/dist/pypy/module/__builtin__/test/impsubdir/compiled/x.pyc
==============================================================================
Binary files. No diff available.
More information about the Pypy-commit
mailing list