Message363300
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 lines of code illustrate it nicely:
def testme():
err = Exception("nothing worked")
try:
raise ValueError("no value")
except ValueError as err:
pass
print(err)
testme() |
|
Date |
User |
Action |
Args |
2020-03-03 20:59:02 | alanr | set | recipients:
+ alanr |
2020-03-03 20:59:02 | alanr | set | messageid: <1583269142.54.0.23852633046.issue39841@roundup.psfhosted.org> |
2020-03-03 20:59:02 | alanr | link | issue39841 messages |
2020-03-03 20:59:02 | alanr | create | |
|