@@ -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
@@ -817,13 +814,13 @@ def format_exception_only(self):
817
814
818
815
The return value is a generator of strings, each ending in a newline.
819
816
820
- Normally, the generator emits a single string; however, for
821
- SyntaxError exceptions, it emits several lines that (when
822
- printed) display detailed information about where the syntax
823
- error occurred.
824
-
825
- The message indicating which exception occurred is always the last
826
- string in the output .
817
+ Generator yields the exception message.
818
+ For :exc:` SyntaxError` exceptions, it
819
+ also yields (before the exception message)
820
+ several lines that (when printed)
821
+ display detailed information about where the syntax error occurred.
822
+ Following the message, generator also yields
823
+ all the exception's ``__notes__`` .
827
824
"""
828
825
if self .exc_type is None :
829
826
yield _format_final_exc_line (None , self ._str )
0 commit comments