Skip to content

Commit c8f6fb6

Browse files
committed
pythongh-102778: update documentation of PyErr_PrintEx regarding sys.last_exc
1 parent 7f5afec commit c8f6fb6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Doc/c-api/exceptions.rst

+8-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,14 @@ Printing and clearing
6060
Call this function **only** when the error indicator is set. Otherwise it
6161
will cause a fatal error!
6262
63-
If *set_sys_last_vars* is nonzero, the variables :data:`sys.last_type`,
64-
:data:`sys.last_value` and :data:`sys.last_traceback` will be set to the
65-
type, value and traceback of the printed exception, respectively.
63+
If *set_sys_last_vars* is nonzero, the variable :data:`sys.last_exc` is
64+
set to the printed exception. For backwards compatibility, the
65+
deprecated variables :data:`sys.last_type`, :data:`sys.last_value` and
66+
:data:`sys.last_traceback` will also be set to the type, value and
67+
traceback of this exception, respectively.
68+
69+
.. versionchanged:: 3.12
70+
:data:`sys.last_exc` was added.
6671
6772
6873
.. c:function:: void PyErr_Print()

0 commit comments

Comments
 (0)