summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-11-15 23:07:58 (GMT)
committerGitHub <noreply@github.com>2021-11-15 23:07:58 (GMT)
commitb0bdc093c2c15c352c5bede060117790705f5db0 (patch)
treed4ecfdbfdd304e3c312d65939d616b462284d56b /Doc
parent3bb2566ce8f12271d83ef0b10e9fe34ef0c270d0 (diff)
downloadcpython-b0bdc093c2c15c352c5bede060117790705f5db0.zip
cpython-b0bdc093c2c15c352c5bede060117790705f5db0.tar.gz
cpython-b0bdc093c2c15c352c5bede060117790705f5db0.tar.bz2
bpo-25381: Update explanation of exceptions in C. (GH-26838) (GH-29569)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> (cherry picked from commit ad43dc0b54994e7e7d06e3d4896ade188b36ee12)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/extending/extending.rst12
1 files changed, 5 insertions, 7 deletions
diff --git a/Doc/extending/extending.rst b/Doc/extending/extending.rst
index bc85a05..a767670 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.