]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.15] gh-150663: Document that PyErr_SetRaisedException accepts null (GH-153046...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 18 Jul 2026 18:18:22 +0000 (20:18 +0200)
committerGitHub <noreply@github.com>
Sat, 18 Jul 2026 18:18:22 +0000 (18:18 +0000)
gh-150663: Document that PyErr_SetRaisedException accepts null (GH-153046)
(cherry picked from commit a0c8329218402396478be92b691043453fc28c32)

Co-authored-by: Andrii Hrimov <andrew.hrimov@gmail.com>
Doc/c-api/exceptions.rst

index 312095ad85f8b62f13224d87184884806af63e94..d9074e6719673ad21302f661ab9075507774c0b4 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