Zachary Ware added the comment: I don't believe this is a bug.
1) try/except does not introduce a new scope 2) 'except E as N' is just name assignment 3) except clauses are documented to always delete the exception alias at the end of the except block[0]. The example in the docs could be clarified to show that except E as N: foo is really more like except E: N = sys.exc_info()[1] try: foo finally: del N Note that 'as' assignment with the 'with' statement also overrides a local variable of the same name. The simplest way to avoid this issue is to use a different name for the exception alias. [0] https://docs.python.org/3/reference/compound_stmts.html#the-try-statement ---------- nosy: +zach.ware _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26174> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com