summaryrefslogtreecommitdiffstats
path: root/Lib/traceback.py
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2023-10-21 15:30:14 (GMT)
committerGitHub <noreply@github.com>2023-10-21 15:30:14 (GMT)
commit5e7727b05232b43589d177c15263d7f4f8c584a0 (patch)
tree464dc9aab5004978b7a1f6afec302e1d91aa271c /Lib/traceback.py
parent9a1fe09622cd0f1e24c2ba5335c94c5d70306fd0 (diff)
downloadcpython-5e7727b05232b43589d177c15263d7f4f8c584a0.zip
cpython-5e7727b05232b43589d177c15263d7f4f8c584a0.tar.gz
cpython-5e7727b05232b43589d177c15263d7f4f8c584a0.tar.bz2
gh-111157: Mention `__notes__` in `traceback.format_exception_only` docstring (#111158)
Diffstat (limited to 'Lib/traceback.py')
-rw-r--r--Lib/traceback.py27
1 files changed, 12 insertions, 15 deletions
diff --git a/Lib/traceback.py b/Lib/traceback.py
index 7cc84b9..d3c581f 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -153,14 +153,11 @@ def format_exception_only(exc, /, value=_sentinel):
The return value is a list of strings, each ending in a newline.
- Normally, the list contains a single string; however, for
- SyntaxError exceptions, it contains several lines that (when
- printed) display detailed information about where the syntax
- error occurred.
-
- The message indicating which exception occurred is always the last
- string in the list.
-
+ The list contains the exception's message, which is
+ normally a single string; however, for :exc:`SyntaxError` exceptions, it
+ contains several lines that (when printed) display detailed information
+ about where the syntax error occurred. Following the message, the list
+ contains the exception's ``__notes__``.
"""
if value is _sentinel:
value = exc
@@ -857,13 +854,13 @@ class TracebackException:
The return value is a generator of strings, each ending in a newline.
- Normally, the generator emits a single string; however, for
- SyntaxError exceptions, it emits several lines that (when
- printed) display detailed information about where the syntax
- error occurred.
-
- The message indicating which exception occurred is always the last
- string in the output.
+ Generator yields the exception message.
+ For :exc:`SyntaxError` exceptions, it
+ also yields (before the exception message)
+ several lines that (when printed)
+ display detailed information about where the syntax error occurred.
+ Following the message, generator also yields
+ all the exception's ``__notes__``.
"""
indent = 3 * _depth * ' '