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!
626263- 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` are also set to the type, value and traceback
67+ of this exception, respectively.
68+69+ .. versionchanged:: 3.12
70+ The setting of :data:`sys.last_exc` was added.
667167726873.. c:function:: void PyErr_Print()
Original file line numberDiff line numberDiff line change@@ -86,10 +86,9 @@ The module defines the following functions:
86868787.. function:: print_last(limit=None, file=None, chain=True)
888889- This is a shorthand for ``print_exception(sys.last_type, sys.last_value,
90- sys.last_traceback, limit, file, chain)``. In general it will work only
91- after an exception has reached an interactive prompt (see
92-:data:`sys.last_type`).
89+ This is a shorthand for ``print_exception(sys.last_exc, limit, file,
90+ chain)``. In general it will work only after an exception has reached
91+ an interactive prompt (see :data:`sys.last_exc`).
939294939594.. function:: print_stack(f=None, limit=None, file=None)