Message382953
Running the following program:
==============================
def foo():
try:
1/0
except ZeroDivisionError as e:
ZeroDivisionError = 1
foo()
==============================
The expected output should be nothing. ZeroDivisionError is caught and then reassignment is executed. However, running this program in Python3.10 will lead to the following error:
Traceback (most recent call last):
File "/home/xxm/Desktop/nameChanging/error/1.py", line 5, in foo
1/0
ZeroDivisionError: division by zero
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/xxm/Desktop/nameChanging/error/1.py", line 8, in <module>
foo()
File "/home/xxm/Desktop/nameChanging/error/1.py", line 6, in foo
except Exception as e:
UnboundLocalError: local variable 'Exception' referenced before assignment |
|
Date |
User |
Action |
Args |
2020-12-14 06:02:52 | xxm | set | recipients:
+ xxm |
2020-12-14 06:02:52 | xxm | set | messageid: <1607925772.13.0.935744871681.issue42632@roundup.psfhosted.org> |
2020-12-14 06:02:52 | xxm | link | issue42632 messages |
2020-12-14 06:02:51 | xxm | create | |
|