diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-11-15 23:06:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-15 23:06:45 (GMT) |
commit | 0320cf1a250b025f2ef25637851384bf8b61d207 (patch) | |
tree | a4e23670ebd5ac9a8f858ea3f171ae9f6addd88a | |
parent | 55d24edaadba4ee90f464d88b44075649788f128 (diff) | |
download | cpython-0320cf1a250b025f2ef25637851384bf8b61d207.zip cpython-0320cf1a250b025f2ef25637851384bf8b61d207.tar.gz cpython-0320cf1a250b025f2ef25637851384bf8b61d207.tar.bz2 |
bpo-25381: Update explanation of exceptions in C. (GH-26838) (GH-29568)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit ad43dc0b54994e7e7d06e3d4896ade188b36ee12)
-rw-r--r-- | Doc/extending/extending.rst | 12 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Documentation/2021-06-21-17-51-51.bpo-25381.7Kn-_H.rst | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/Doc/extending/extending.rst b/Doc/extending/extending.rst index 561d1c6..2e3362b 100644 --- a/Doc/extending/extending.rst +++ b/Doc/extending/extending.rst @@ -127,13 +127,11 @@ Intermezzo: Errors and Exceptions 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 -(usually a ``NULL`` pointer). Exceptions are stored in a static global variable -inside the interpreter; if this variable is ``NULL`` no exception has occurred. A -second global variable stores the "associated value" of the exception (the -second argument to :keyword:`raise`). A third variable contains the stack -traceback in case the error originated in Python code. These three variables -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 +(usually ``-1`` or a ``NULL`` pointer). Exception information is stored in +three members of the interpreter's thread state. These are ``NULL`` if +there is no exception. Otherwise they are the C equivalents of the members +of the Python tuple returned by :meth:`sys.exc_info`. These are the +exception type, exception instance, and a traceback object. It is important 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. diff --git a/Misc/NEWS.d/next/Documentation/2021-06-21-17-51-51.bpo-25381.7Kn-_H.rst b/Misc/NEWS.d/next/Documentation/2021-06-21-17-51-51.bpo-25381.7Kn-_H.rst new file mode 100644 index 0000000..f009f88 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2021-06-21-17-51-51.bpo-25381.7Kn-_H.rst @@ -0,0 +1,2 @@ +In the extending chapter of the extending doc, update a paragraph about the +global variables containing exception information. |