Shouldn't that go to trunk as well?
On Sun, Jan 22, 2012 at 1:10 PM, amauryfa <[email protected]> wrote: > Author: Amaury Forgeot d'Arc <[email protected]> > Branch: py3k > Changeset: r51639:e325e4d3227a > Date: 2012-01-22 12:02 +0100 > http://bitbucket.org/pypy/pypy/changeset/e325e4d3227a/ > > Log: The exception handler target "except ValueError as exc" was always > compiled as a global variable. Test and fix. > > diff --git a/pypy/interpreter/astcompiler/symtable.py > b/pypy/interpreter/astcompiler/symtable.py > --- a/pypy/interpreter/astcompiler/symtable.py > +++ b/pypy/interpreter/astcompiler/symtable.py > @@ -417,6 +417,11 @@ > def visit_alias(self, alias): > self._visit_alias(alias) > > + def visit_ExceptHandler(self, handler): > + if handler.name: > + self.note_symbol(handler.name, SYM_ASSIGNED) > + ast.GenericASTVisitor.visit_ExceptHandler(self, handler) > + > def visit_Yield(self, yie): > self.scope.note_yield(yie) > ast.GenericASTVisitor.visit_Yield(self, yie) > diff --git a/pypy/interpreter/astcompiler/test/test_symtable.py > b/pypy/interpreter/astcompiler/test/test_symtable.py > --- a/pypy/interpreter/astcompiler/test/test_symtable.py > +++ b/pypy/interpreter/astcompiler/test/test_symtable.py > @@ -142,6 +142,10 @@ > scp = self.func_scope("def f(): x") > assert scp.lookup("x") == symtable.SCOPE_GLOBAL_IMPLICIT > > + def test_exception_variable(self): > + scp = self.mod_scope("try: pass\nexcept ValueError as e: pass") > + assert scp.lookup("e") == symtable.SCOPE_LOCAL > + > def test_nested_scopes(self): > def nested_scope(*bodies): > names = enumerate("f" + string.ascii_letters) > _______________________________________________ > pypy-commit mailing list > [email protected] > http://mail.python.org/mailman/listinfo/pypy-commit _______________________________________________ pypy-dev mailing list [email protected] http://mail.python.org/mailman/listinfo/pypy-dev
