FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.12] gh-102778: update documentation of PyErr_PrintEx and traceback.print_last() regarding sys.last_exc (GH-105190) by miss-islington · Pull Request #105246 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .rst  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
11 changes: 8 additions & 3 deletions Doc/c-api/exceptions.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 3 additions & 4 deletions Doc/library/traceback.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

Back | FazBrowse Home | New Git URL