https://github.com/python/cpython/commit/a0c8329218402396478be92b691043453fc28c32
commit: a0c8329218402396478be92b691043453fc28c32
branch: main
author: Andrii Hrimov <[email protected]>
committer: vstinner <[email protected]>
date: 2026-07-18T20:10:05+02:00
summary:

gh-150663: Document that PyErr_SetRaisedException accepts null (#153046)

files:
M Doc/c-api/exceptions.rst

diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst
index 78c95791ab3104..d04074f6e6a799 100644
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -499,12 +499,12 @@ Querying the error indicator
 .. c:function:: void PyErr_SetRaisedException(PyObject *exc)
 
    Set *exc* as the exception currently being raised,
-   clearing the existing exception if one is set.
+   clearing the existing exception if one is set.  If *exc* is ``NULL``,
+   just clear the existing exception.
 
-   .. warning::
+   *exc* must be a valid exception or ``NULL``.
 
-      This call ":term:`steals <steal>`" a reference to *exc*,
-      which must be a valid exception.
+   This call ":term:`steals <steal>`" a reference to *exc*.
 
    .. versionadded:: 3.12
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to