]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-102778: update documentation of PyErr_PrintEx and traceback.print_last() regarding...
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>
Fri, 2 Jun 2023 16:01:46 +0000 (17:01 +0100)
committerGitHub <noreply@github.com>
Fri, 2 Jun 2023 16:01:46 +0000 (17:01 +0100)
Doc/c-api/exceptions.rst
Doc/library/traceback.rst

index dc73ad8157961bf67ce6cd6c3af3c951574f7c58..1694aa2db9c9da4e1b9e1f411e8388c5725ee94f 100644 (file)
@@ -60,9 +60,14 @@ Printing and clearing
    Call this function **only** when the error indicator is set.  Otherwise it
    will cause a fatal error!
 
-   If *set_sys_last_vars* is nonzero, the variables :data:`sys.last_type`,
-   :data:`sys.last_value` and :data:`sys.last_traceback` will be set to the
-   type, value and traceback of the printed exception, respectively.
+   If *set_sys_last_vars* is nonzero, the variable :data:`sys.last_exc` is
+   set to the printed exception. For backwards compatibility, the
+   deprecated variables :data:`sys.last_type`, :data:`sys.last_value` and
+   :data:`sys.last_traceback` are also set to the type, value and traceback
+   of this exception, respectively.
+
+   .. versionchanged:: 3.12
+      The setting of :data:`sys.last_exc` was added.
 
 
 .. c:function:: void PyErr_Print()
index 9a04b56947a1bb454d64071707558073b91902aa..58f47818fcecabaef8eee00235137bb9689b7571 100644 (file)
@@ -86,10 +86,9 @@ The module defines the following functions:
 
 .. function:: print_last(limit=None, file=None, chain=True)
 
-   This is a shorthand for ``print_exception(sys.last_type, sys.last_value,
-   sys.last_traceback, limit, file, chain)``.  In general it will work only
-   after an exception has reached an interactive prompt (see
-   :data:`sys.last_type`).
+   This is a shorthand for ``print_exception(sys.last_exc, limit, file,
+   chain)``.  In general it will work only after an exception has reached
+   an interactive prompt (see :data:`sys.last_exc`).
 
 
 .. function:: print_stack(f=None, limit=None, file=None)