summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2023-10-27 10:11:26 (GMT)
committerGitHub <noreply@github.com>2023-10-27 10:11:26 (GMT)
commitaa732459c5a69435f13a2730a057ce9d2087873b (patch)
treef33da8d6d12614179e47d2ebf2136c982396a51d /Doc/library
parent6d42759c5e47ab62d60a72b4ff15d29864554579 (diff)
downloadcpython-aa732459c5a69435f13a2730a057ce9d2087873b.zip
cpython-aa732459c5a69435f13a2730a057ce9d2087873b.tar.gz
cpython-aa732459c5a69435f13a2730a057ce9d2087873b.tar.bz2
gh-111388: Add `show_group` parameter to `traceback.format_exception_only` (#111390)
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/traceback.rst9
1 files changed, 8 insertions, 1 deletions
diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst
index 67ee73d..408da7f 100644
--- a/Doc/library/traceback.rst
+++ b/Doc/library/traceback.rst
@@ -135,7 +135,7 @@ The module defines the following functions:
text line is not ``None``.
-.. function:: format_exception_only(exc, /[, value])
+.. function:: format_exception_only(exc, /[, value], *, show_group=False)
Format the exception part of a traceback using an exception value such as
given by ``sys.last_value``. The return value is a list of strings, each
@@ -149,6 +149,10 @@ The module defines the following functions:
can be passed as the first argument. If *value* is provided, the first
argument is ignored in order to provide backwards compatibility.
+ When *show_group* is ``True``, and the exception is an instance of
+ :exc:`BaseExceptionGroup`, the nested exceptions are included as
+ well, recursively, with indentation relative to their nesting depth.
+
.. versionchanged:: 3.10
The *etype* parameter has been renamed to *exc* and is now
positional-only.
@@ -156,6 +160,9 @@ The module defines the following functions:
.. versionchanged:: 3.11
The returned list now includes any notes attached to the exception.
+ .. versionchanged:: 3.13
+ *show_group* parameter was added.
+
.. function:: format_exception(exc, /[, value, tb], limit=None, chain=True)