bpo-25381: Update explanation of exceptions in C. (GH-26838)

* bpo-25381: Update explanation of exception globals

This paragraph in extending/extending.rst was unchanged (except for
NULL markup) since committed in 2007 Aug 15 for 2.6 alpha.

* Respond to reviews and remove duplication.

* Update Doc/extending/extending.rst

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Terry Jan Reedy 2021-11-15 17:38:53 -05:00 committed by GitHub
parent c750adbe69
commit ad43dc0b54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -127,13 +127,11 @@ Intermezzo: Errors and Exceptions
An important convention throughout the Python interpreter is the following: when An important convention throughout the Python interpreter is the following: when
a function fails, it should set an exception condition and return an error value a function fails, it should set an exception condition and return an error value
(usually a ``NULL`` pointer). Exceptions are stored in a static global variable (usually ``-1`` or a ``NULL`` pointer). Exception information is stored in
inside the interpreter; if this variable is ``NULL`` no exception has occurred. A three members of the interpreter's thread state. These are ``NULL`` if
second global variable stores the "associated value" of the exception (the there is no exception. Otherwise they are the C equivalents of the members
second argument to :keyword:`raise`). A third variable contains the stack of the Python tuple returned by :meth:`sys.exc_info`. These are the
traceback in case the error originated in Python code. These three variables exception type, exception instance, and a traceback object. It is important
are the C equivalents of the result in Python of :meth:`sys.exc_info` (see the
section on module :mod:`sys` in the Python Library Reference). It is important
to know about them to understand how errors are passed around. to know about them to understand how errors are passed around.
The Python API defines a number of functions to set various types of exceptions. The Python API defines a number of functions to set various types of exceptions.

View file

@ -0,0 +1,2 @@
In the extending chapter of the extending doc, update a paragraph about the
global variables containing exception information.