@@ -145,14 +145,11 @@ def format_exception_only(exc, /, value=_sentinel):
145
145
146
146
The return value is a list of strings, each ending in a newline.
147
147
148
- Normally, the list contains a single string; however, for
149
- SyntaxError exceptions, it contains several lines that (when
150
- printed) display detailed information about where the syntax
151
- error occurred.
152
-
153
- The message indicating which exception occurred is always the last
154
- string in the list.
155
-
148
+ The list contains the exception's message, which is
149
+ normally a single string; however, for :exc:`SyntaxError` exceptions, it
150
+ contains several lines that (when printed) display detailed information
151
+ about where the syntax error occurred. Following the message, the list
152
+ contains the exception's ``__notes__``.
156
153
"""
157
154
if value is _sentinel :
158
155
value = exc
@@ -841,13 +838,13 @@ def format_exception_only(self):
841
838
842
839
The return value is a generator of strings, each ending in a newline.
843
840
844
- Normally, the generator emits a single string; however, for
845
- SyntaxError exceptions, it emits several lines that (when
846
- printed) display detailed information about where the syntax
847
- error occurred.
848
-
849
- The message indicating which exception occurred is always the last
850
- string in the output .
841
+ Generator yields the exception message.
842
+ For :exc:` SyntaxError` exceptions, it
843
+ also yields (before the exception message)
844
+ several lines that (when printed)
845
+ display detailed information about where the syntax error occurred.
846
+ Following the message, generator also yields
847
+ all the exception's ``__notes__`` .
851
848
"""
852
849
if self .exc_type is None :
853
850
yield _format_final_exc_line (None , self ._str )
0 commit comments