]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-150663: Document that PyErr_SetRaisedException accepts null (#153046)
authorAndrii Hrimov <andrew.hrimov@gmail.com>
Sat, 18 Jul 2026 18:10:05 +0000 (20:10 +0200)
committerGitHub <noreply@github.com>
Sat, 18 Jul 2026 18:10:05 +0000 (20:10 +0200)
Doc/c-api/exceptions.rst

index 78c95791ab310413b4f2111e5f4061b103c69110..d04074f6e6a79930bed766522ebf47084ce8dc50 100644 (file)
@@ -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