From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sat, 18 Jul 2026 18:17:48 +0000 (+0200) Subject: [3.14] gh-150663: Document that PyErr_SetRaisedException accepts null (GH-153046... X-Git-Url: http://git.ipfire.org/index.cgi?a=commitdiff_plain;h=3cefb64f6e116f0bf4a71b81c455279ab74ae205;p=thirdparty%2FPython%2Fcpython.git [3.14] gh-150663: Document that PyErr_SetRaisedException accepts null (GH-153046) (#154022) gh-150663: Document that PyErr_SetRaisedException accepts null (GH-153046) (cherry picked from commit a0c8329218402396478be92b691043453fc28c32) Co-authored-by: Andrii Hrimov --- diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index 6e9b0733fb62..4ff7122fe3f9 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 `" a reference to *exc*, - which must be a valid exception. + This call ":term:`steals `" a reference to *exc*. .. versionadded:: 3.12