[3.12] gh-111157: Mention __notes__ in traceback.format_exception_only docstring (GH-111158) (#111163)

gh-111157: Mention `__notes__` in `traceback.format_exception_only` docstring (GH-111158)
(cherry picked from commit 5e7727b052)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
Miss Islington (bot) 2023-10-21 19:07:09 +02:00 committed by GitHub
parent 552ceb2d0f
commit 6a5ff93654
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -145,14 +145,11 @@ def format_exception_only(exc, /, value=_sentinel):
The return value is a list of strings, each ending in a newline. The return value is a list of strings, each ending in a newline.
Normally, the list contains a single string; however, for The list contains the exception's message, which is
SyntaxError exceptions, it contains several lines that (when normally a single string; however, for :exc:`SyntaxError` exceptions, it
printed) display detailed information about where the syntax contains several lines that (when printed) display detailed information
error occurred. about where the syntax error occurred. Following the message, the list
contains the exception's ``__notes__``.
The message indicating which exception occurred is always the last
string in the list.
""" """
if value is _sentinel: if value is _sentinel:
value = exc value = exc
@ -841,13 +838,13 @@ class TracebackException:
The return value is a generator of strings, each ending in a newline. The return value is a generator of strings, each ending in a newline.
Normally, the generator emits a single string; however, for Generator yields the exception message.
SyntaxError exceptions, it emits several lines that (when For :exc:`SyntaxError` exceptions, it
printed) display detailed information about where the syntax also yields (before the exception message)
error occurred. several lines that (when printed)
display detailed information about where the syntax error occurred.
The message indicating which exception occurred is always the last Following the message, generator also yields
string in the output. all the exception's ``__notes__``.
""" """
if self.exc_type is None: if self.exc_type is None:
yield _format_final_exc_line(None, self._str) yield _format_final_exc_line(None, self._str)