New submission from Shlomi <vgtv...@gmail.com>:

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.

----------
components: Interpreter Core
messages: 401486
nosy: ShlomiRex
priority: normal
severity: normal
status: open
title: Except multiple types of exceptions with OR keyword is not working
type: behavior
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45153>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to