Skip to content

Commit ad43dc0

Browse files
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>
1 parent c750adb commit ad43dc0

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Doc/extending/extending.rst

+5-7
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,11 @@ Intermezzo: Errors and Exceptions
127127

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

139137
The Python API defines a number of functions to set various types of exceptions.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
In the extending chapter of the extending doc, update a paragraph about the
2+
global variables containing exception information.

0 commit comments

Comments
 (0)