mirror of
https://github.com/python/cpython.git
synced 2025-10-21 22:22:48 +00:00
gh-103791: Make contextlib.suppress also act on exceptions within an ExceptionGroup (#103792)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
This commit is contained in:
parent
19e4f757de
commit
22bed58e53
6 changed files with 73 additions and 22 deletions
|
@ -304,8 +304,15 @@ Functions and classes provided:
|
|||
|
||||
This context manager is :ref:`reentrant <reentrant-cms>`.
|
||||
|
||||
If the code within the :keyword:`!with` block raises an
|
||||
:exc:`ExceptionGroup`, suppressed exceptions are removed from the
|
||||
group. If any exceptions in the group are not suppressed, a group containing them is re-raised.
|
||||
|
||||
.. versionadded:: 3.4
|
||||
|
||||
.. versionchanged:: 3.12
|
||||
``suppress`` now supports suppressing exceptions raised as
|
||||
part of an :exc:`ExceptionGroup`.
|
||||
|
||||
.. function:: redirect_stdout(new_target)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue