diff --git a/pep-0654.rst b/pep-0654.rst index 1c64e3737..ccd9a634c 100644 --- a/pep-0654.rst +++ b/pep-0654.rst @@ -186,7 +186,9 @@ contains only those exceptions for which the condition is true: Empty nested ``ExceptionGroups`` are omitted from the result, as in the -case of ``ExceptionGroup("three")`` in the example above. The original ``eg`` +case of ``ExceptionGroup("three")`` in the example above. If none of the +leaf exceptions match the condition, ``subgroup`` returns ``None`` rather +than an empty ``ExceptionGroup``. The original ``eg`` is unchanged by ``subgroup``, but the value returned is not necessarily a full new copy. Leaf exceptions are not copied, nor are ``ExceptionGroups`` which are fully contained in the result. When it is necessary to partition an @@ -860,6 +862,11 @@ with ``except*`` because the latter is ambiguous: except *ExceptionGroup: # <- Runtime error pass + try: + ... + except *(TypeError, ExceptionGroup): # <- Runtime error + pass + An empty "match anything" ``except*`` block is not supported as its meaning may be confusing: