[issue45153] Except multiple types of exceptions with OR keyword is not working

Serhiy Storchaka report at bugs.python.org
Thu Sep 9 12:10:33 EDT 2021


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Expression `A or B` gets you A if A is true.

If you want to catch several types of exception by one "except", use except with a tuple:

    except (ConnectionResetError, ConnectionAbortedError):

----------
nosy: +serhiy.storchaka
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45153>
_______________________________________


More information about the Python-bugs-list mailing list