[pypy-svn] r24205 - in pypy/dist/pypy/interpreter: astcompiler test
ac at codespeak.net
ac at codespeak.net
Fri Mar 10 10:23:11 CET 2006
Author: ac
Date: Fri Mar 10 10:23:10 2006
New Revision: 24205
Modified:
pypy/dist/pypy/interpreter/astcompiler/symbols.py
pypy/dist/pypy/interpreter/test/test_nestedscope.py
Log:
A GenExpr is a kind of function.
Modified: pypy/dist/pypy/interpreter/astcompiler/symbols.py
==============================================================================
--- pypy/dist/pypy/interpreter/astcompiler/symbols.py (original)
+++ pypy/dist/pypy/interpreter/astcompiler/symbols.py Fri Mar 10 10:23:10 2006
@@ -188,7 +188,7 @@
GenExprScopeCounter = Counter(1)
-class GenExprScope(Scope):
+class GenExprScope(FunctionScope):
def __init__(self, module, klass=None):
i = GenExprScopeCounter.next()
@@ -292,15 +292,13 @@
def visitGenExpr(self, node ):
parent = self.cur_scope()
scope = GenExprScope(self.module, self.klass);
- if parent.nested or isinstance(parent, FunctionScope) \
- or isinstance(parent, GenExprScope):
+ if parent.nested or isinstance(parent, FunctionScope):
scope.nested = 1
node.scope = scope
self.push_scope(scope)
node.code.accept(self)
self.pop_scope()
-
self.handle_free_vars(scope, parent)
def visitGenExprInner(self, node ):
Modified: pypy/dist/pypy/interpreter/test/test_nestedscope.py
==============================================================================
--- pypy/dist/pypy/interpreter/test/test_nestedscope.py (original)
+++ pypy/dist/pypy/interpreter/test/test_nestedscope.py Fri Mar 10 10:23:10 2006
@@ -57,3 +57,6 @@
keys = outer_locals.keys()
keys.sort()
assert keys == ['h', 'x']
+
+ def test_lambda_in_genexpr(self):
+ assert eval('map(apply, (lambda: t for t in range(10)))') == range(10)
More information about the Pypy-commit
mailing list