]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-119287: clarify doc on BaseExceptionGroup.derive and link to it from contextlib...
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>
Wed, 5 Jun 2024 11:56:01 +0000 (12:56 +0100)
committerGitHub <noreply@github.com>
Wed, 5 Jun 2024 11:56:01 +0000 (11:56 +0000)
Doc/library/contextlib.rst
Doc/library/exceptions.rst

index bad9da52d6a6ca9fdff0013a44a46f03a5d11da4..27cf99446e5980471561d6235b251ca5c9e2ef30 100644 (file)
@@ -314,7 +314,9 @@ Functions and classes provided:
 
    If the code within the :keyword:`!with` block raises a
    :exc:`BaseExceptionGroup`, suppressed exceptions are removed from the
-   group.  If any exceptions in the group are not suppressed, a group containing them is re-raised.
+   group.  Any exceptions of the group which are not suppressed are re-raised in
+   a new group which is created using the original group's :meth:`~BaseExceptionGroup.derive`
+   method.
 
    .. versionadded:: 3.4
 
index 7879fb015bddfa35e07131ba071e5d794642809f..7910b306f143d7568d94bd7c452cd8e3eef143d3 100644 (file)
@@ -989,7 +989,8 @@ their subgroups based on the types of the contained exceptions.
       Returns an exception group with the same :attr:`message`, but which
       wraps the exceptions in ``excs``.
 
-      This method is used by :meth:`subgroup` and :meth:`split`. A
+      This method is used by :meth:`subgroup` and :meth:`split`, which
+      are used in various contexts to break up an exception group. A
       subclass needs to override it in order to make :meth:`subgroup`
       and :meth:`split` return instances of the subclass rather
       than :exc:`ExceptionGroup`.