Skip to content

Commit 8e0c80a

Browse files
[3.13] gh-119287: clarify doc on BaseExceptionGroup.derive and link to it from contextlib.suppress (GH-119657) (#120105)
gh-119287: clarify doc on BaseExceptionGroup.derive and link to it from contextlib.suppress (GH-119657) (cherry picked from commit 5c02ea8) Co-authored-by: Irit Katriel <[email protected]>
1 parent 71f86ee commit 8e0c80a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Doc/library/contextlib.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,9 @@ Functions and classes provided:
314314

315315
If the code within the :keyword:`!with` block raises a
316316
:exc:`BaseExceptionGroup`, suppressed exceptions are removed from the
317-
group. If any exceptions in the group are not suppressed, a group containing them is re-raised.
317+
group. Any exceptions of the group which are not suppressed are re-raised in
318+
a new group which is created using the original group's :meth:`~BaseExceptionGroup.derive`
319+
method.
318320

319321
.. versionadded:: 3.4
320322

Doc/library/exceptions.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,8 @@ their subgroups based on the types of the contained exceptions.
989989
Returns an exception group with the same :attr:`message`, but which
990990
wraps the exceptions in ``excs``.
991991

992-
This method is used by :meth:`subgroup` and :meth:`split`. A
992+
This method is used by :meth:`subgroup` and :meth:`split`, which
993+
are used in various contexts to break up an exception group. A
993994
subclass needs to override it in order to make :meth:`subgroup`
994995
and :meth:`split` return instances of the subclass rather
995996
than :exc:`ExceptionGroup`.

0 commit comments

Comments
 (0)