[pypy-svn] r66240 - in pypy/branch/parser-compiler/pypy/interpreter/astcompiler: . test
benjamin at codespeak.net
benjamin at codespeak.net
Wed Jul 15 16:49:22 CEST 2009
Author: benjamin
Date: Wed Jul 15 16:49:22 2009
New Revision: 66240
Modified:
pypy/branch/parser-compiler/pypy/interpreter/astcompiler/symtable.py
pypy/branch/parser-compiler/pypy/interpreter/astcompiler/test/test_symtable.py
Log:
correctly handle lambdas with default arguments
Modified: pypy/branch/parser-compiler/pypy/interpreter/astcompiler/symtable.py
==============================================================================
--- pypy/branch/parser-compiler/pypy/interpreter/astcompiler/symtable.py (original)
+++ pypy/branch/parser-compiler/pypy/interpreter/astcompiler/symtable.py Wed Jul 15 16:49:22 2009
@@ -360,7 +360,7 @@
def visit_Lambda(self, lamb):
if lamb.args.defaults:
- self.visit_sequence(lamb.defaults)
+ self.visit_sequence(lamb.args.defaults)
self.push_scope(FunctionScope(lamb, "lambda"))
lamb.args.walkabout(self)
lamb.body.walkabout(self)
Modified: pypy/branch/parser-compiler/pypy/interpreter/astcompiler/test/test_symtable.py
==============================================================================
--- pypy/branch/parser-compiler/pypy/interpreter/astcompiler/test/test_symtable.py (original)
+++ pypy/branch/parser-compiler/pypy/interpreter/astcompiler/test/test_symtable.py Wed Jul 15 16:49:22 2009
@@ -190,6 +190,11 @@
assert lscp.name == "lambda"
assert lscp.lookup("x") == symtable.SCOPE_LOCAL
assert lscp.lookup("y") == symtable.SCOPE_GLOBAL_IMPLICIT
+ scp = self.mod_scope("lambda x=a: b")
+ self.check_unknown(scp, "x", "b")
+ assert scp.lookup("a") == symtable.SCOPE_GLOBAL_IMPLICIT
+ lscp = scp.children[0]
+ self.check_unknown(lscp, "a")
def test_import(self):
scp = self.mod_scope("import x")
More information about the Pypy-commit
mailing list