From edb1058c4a7fd38f9a0aab2f42c85424ec9347e3 Mon Sep 17 00:00:00 2001 From: Andrii Hrimov Date: Sat, 18 Jul 2026 20:10:05 +0200 Subject: [PATCH] gh-150663: Document that PyErr_SetRaisedException accepts null (GH-153046) (cherry picked from commit a0c8329218402396478be92b691043453fc28c32) Co-authored-by: Andrii Hrimov --- Doc/c-api/exceptions.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst index 312095ad85f8b62..d9074e6719673ad 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