Skip to content

Commit fc68664

Browse files
committed
bpo-23188: Document that PyErr_SetString, etc. chains exceptions
1 parent af23f0d commit fc68664

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Doc/c-api/exceptions.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ Raising exceptions
9292
9393
These functions help you set the current thread's error indicator.
9494
For convenience, some of these functions will always return a
95-
``NULL`` pointer for use in a ``return`` statement.
95+
``NULL`` pointer for use in a ``return`` statement. Also, for all of the
96+
functions in this subsection, if an exception has already been caught,
97+
that exception will be implicitly chained (i.e. the last caught exception
98+
will become the new exception's :attr:`__context__`).
9699
97100
98101
.. c:function:: void PyErr_SetString(PyObject *type, const char *message)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Mention that :c:func:`PyErr_SetString`, :c:func:`PyErr_SetObject`, and
2+
friends implicitly chain exceptions.

0 commit comments

Comments
 (0)