[issue39841] "as" variable in except block deletes local variables with same name

2020-03-03 Thread Alan Robertson
Alan Robertson added the comment: Thanks for your kind explanation. I may even vaguely remember seeing this sometime in the past. Thanks much for your time! -- ___ Python tracker ___

[issue39841] "as" variable in except block deletes local variables with same name

2020-03-03 Thread Eric V. Smith
Eric V. Smith added the comment: Yes, this is a known issue. See https://docs.python.org/3/reference/compound_stmts.html#the-try-statement, in particular the sentence "When an exception has been assigned using as target, it is cleared at the end of the except clause" and the following text.

[issue39841] "as" variable in except block deletes local variables with same name

2020-03-03 Thread Rémi Lapeyre
Rémi Lapeyre added the comment: Hi Alan, this is documented at https://docs.python.org/3/reference/compound_stmts.html#the-try-statement: > When an exception has been assigned using as target, it is cleared at the end > of the except clause. This is as if > > except E as N: >foo > > was

[issue39841] "as" variable in except block deletes local variables with same name

2020-03-03 Thread Alan Robertson
New submission from Alan Robertson : When an exception "as" variable occurs, it deletes local variables with the same name. This is certainly surprising, and doesn't appear to be a documented behavior (but maybe I don't know where to look). The word "bug" comes to mind. The following few lin