summaryrefslogtreecommitdiffstats
path: root/Doc/library/contextlib.rst
diff options
context:
space:
mode:
authorƁukasz Langa <lukasz@langa.pl>2023-04-24 22:17:02 (GMT)
committerGitHub <noreply@github.com>2023-04-24 22:17:02 (GMT)
commit22bed58e531ce780d91f3364c5ace98fad28c2e8 (patch)
tree09719c749f02573ed8f47cb5f682651596f008e8 /Doc/library/contextlib.rst
parent19e4f757de8c7cf2b4b9b4cbb32e376d0e50d2d4 (diff)
downloadcpython-22bed58e531ce780d91f3364c5ace98fad28c2e8.zip
cpython-22bed58e531ce780d91f3364c5ace98fad28c2e8.tar.gz
cpython-22bed58e531ce780d91f3364c5ace98fad28c2e8.tar.bz2
gh-103791: Make contextlib.suppress also act on exceptions within an ExceptionGroup (#103792)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Diffstat (limited to 'Doc/library/contextlib.rst')
-rw-r--r--Doc/library/contextlib.rst7
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/library/contextlib.rst b/Doc/library/contextlib.rst
index 1b55868..7cd081d 100644
--- a/Doc/library/contextlib.rst
+++ b/Doc/library/contextlib.rst
@@ -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)