]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-111157: Mention `__notes__` in `traceback.format_exception_only` docstring (#111158)
authorNikita Sobolev <mail@sobolevn.me>
Sat, 21 Oct 2023 15:30:14 +0000 (18:30 +0300)
committerGitHub <noreply@github.com>
Sat, 21 Oct 2023 15:30:14 +0000 (15:30 +0000)
Lib/traceback.py

index 7cc84b9c762aeb0bca69a31f15486302dcd542da..d3c581f92ba1b8731a6e3c8ff53d70e69a145a81 100644 (file)
@@ -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 * ' '