Message401486
When I want to catch multiple types of exceptions naturally 'OR' keyword is used. But it doesn't work. The interpreter doesn't show any error for the syntax, so developer may think it would work.
Small example:
try:
myfunc()
except ConnectionResetError or ConnectionAbortedError:
print("foo")
except Exception as e:
print("bar")
When myfunc() throws 'ConnectionAbortedError' the interpreter enters "bar" block, and not "foo" block. |
|
Date |
User |
Action |
Args |
2021-09-09 14:35:50 | ShlomiRex | set | recipients:
+ ShlomiRex |
2021-09-09 14:35:50 | ShlomiRex | set | messageid: <1631198150.11.0.821790716144.issue45153@roundup.psfhosted.org> |
2021-09-09 14:35:50 | ShlomiRex | link | issue45153 messages |
2021-09-09 14:35:50 | ShlomiRex | create | |
|