[issue26174] Exception alias cause destruction of existing variable

2016-01-21 Thread Brett Cannon
Brett Cannon added the comment: So the exception is explicitly deleted when the `except` block is exited to prevent leaking memory from the traceback attached to the exception. Hence there's an implicit `del e` at the end of the `except` block which is what you're running up against. But I'm

[issue26174] Exception alias cause destruction of existing variable

2016-01-21 Thread Zachary Ware
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 clari

[issue26174] Exception alias cause destruction of existing variable

2016-01-21 Thread Ethan Furman
Changes by Ethan Furman : -- nosy: +ethan.furman ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue26174] Exception alias cause destruction of existing variable

2016-01-21 Thread Jan Pokorny
New submission from Jan Pokorny: Encountered a weird behavior when working with variable with the same name as exception's alias. Observed behavior: - In case variable with the same name (e.g. 'e') already exists when any 'except Error as e' block is executed, the 'e' variable is removed afte