[pypy-svn] r66246 - in pypy/branch/parser-compiler/pypy/interpreter/astcompiler: . test
benjamin at codespeak.net
benjamin at codespeak.net
Wed Jul 15 20:36:44 CEST 2009
Author: benjamin
Date: Wed Jul 15 20:36:43 2009
New Revision: 66246
Modified:
pypy/branch/parser-compiler/pypy/interpreter/astcompiler/symtable.py
pypy/branch/parser-compiler/pypy/interpreter/astcompiler/test/test_symtable.py
Log:
we need a temporary variable for the ctx result, too
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 20:36:43 2009
@@ -404,6 +404,8 @@
def visit_With(self, wih):
self.new_temporary_name()
+ if wih.optional_vars:
+ self.new_temporary_name()
ast.GenericASTVisitor.visit_With(self, wih)
def visit_arguments(self, arguments):
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 20:36:43 2009
@@ -313,6 +313,9 @@
assert scp.lookup("_[0]") == symtable.SCOPE_LOCAL
scp = self.mod_scope("with x: pass")
assert scp.lookup("_[0]") == symtable.SCOPE_LOCAL
+ scp = self.mod_scope("with x as y: pass")
+ assert scp.lookup("_[0]") == symtable.SCOPE_LOCAL
+ assert scp.lookup("_[1]") == symtable.SCOPE_LOCAL
# Just in case.
scp = self.mod_scope("with [x for y in z]: pass")
assert scp.lookup("_[0]") == symtable.SCOPE_LOCAL
More information about the Pypy-commit
mailing list