Python 3.11 introduced except*
and ExceptionGroup
. While it’s possible to catch the ExceptionGroup and BaseExceptionGroup
types with except`
, a Runtime error will be raised when this is done with except*
. See PEP 654 : PEP-654
Noncompliant Code Example
try:
...
except* ExceptionGroup: # Noncompliant
pass
try:
...
except* (TypeError, ExceptionGroup): # Noncompliant
pass
Compliant Solution
try:
...
except ExceptionGroup:
pass
See
PEP-654