Skip to content

Commit ffbee6f

Browse files
sobolevnaisk
authored andcommitted
pythongh-111157: Mention __notes__ in traceback.format_exception_only docstring (python#111158)
1 parent f32f0eb commit ffbee6f

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

Lib/traceback.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,11 @@ def format_exception_only(exc, /, value=_sentinel):
153153
154154
The return value is a list of strings, each ending in a newline.
155155
156-
Normally, the list contains a single string; however, for
157-
SyntaxError exceptions, it contains several lines that (when
158-
printed) display detailed information about where the syntax
159-
error occurred.
160-
161-
The message indicating which exception occurred is always the last
162-
string in the list.
163-
156+
The list contains the exception's message, which is
157+
normally a single string; however, for :exc:`SyntaxError` exceptions, it
158+
contains several lines that (when printed) display detailed information
159+
about where the syntax error occurred. Following the message, the list
160+
contains the exception's ``__notes__``.
164161
"""
165162
if value is _sentinel:
166163
value = exc
@@ -857,13 +854,13 @@ def format_exception_only(self, *, show_group=False, _depth=0):
857854
858855
The return value is a generator of strings, each ending in a newline.
859856
860-
Normally, the generator emits a single string; however, for
861-
SyntaxError exceptions, it emits several lines that (when
862-
printed) display detailed information about where the syntax
863-
error occurred.
864-
865-
The message indicating which exception occurred is always the last
866-
string in the output.
857+
Generator yields the exception message.
858+
For :exc:`SyntaxError` exceptions, it
859+
also yields (before the exception message)
860+
several lines that (when printed)
861+
display detailed information about where the syntax error occurred.
862+
Following the message, generator also yields
863+
all the exception's ``__notes__``.
867864
"""
868865

869866
indent = 3 * _depth * ' '

0 commit comments

Comments
 (0)