diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-06-02 09:04:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-02 17:04:22 +0100 |
commit | 00fe6186cb8bb5de9ab1604521dfd2584a487545 (patch) | |
tree | bf04c5d2832cd565bd58af8fb0001fd7bf1faf47 | |
parent | [3.12] gh-105194: Fix format specifier escaped characters in f-strings (GH-10... (diff) | |
download | cpython-00fe6186cb8bb5de9ab1604521dfd2584a487545.tar.gz cpython-00fe6186cb8bb5de9ab1604521dfd2584a487545.tar.bz2 cpython-00fe6186cb8bb5de9ab1604521dfd2584a487545.zip |
[3.12] gh-102778: update documentation of PyErr_PrintEx and traceback.print_last() regarding sys.last_exc (GH-105190) (#105246)
gh-102778: update documentation of PyErr_PrintEx and traceback.print_last() regarding sys.last_exc (GH-105190)
(cherry picked from commit 0dafc785ee6629dbcb9bec6f7aee43a56cd0b26e)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
-rw-r--r-- | Doc/c-api/exceptions.rst | 11 | ||||
-rw-r--r-- | Doc/library/traceback.rst | 7 |
2 files changed, 11 insertions, 7 deletions
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index dc73ad81579..1694aa2db9c 100644 --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -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() diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst index 9a04b56947a..58f47818fce 100644 --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -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) |