Skip to content

Commit 251e0dc

Browse files
committed
gh-152912: Fix stale C-API doc for PySys_AddAuditHook exception suppression
Doc/c-api/sys.rst still said Exception for the suppression behavior, matching the buggy Python-API code at sysmodule.c:530. The C-API code at sysmodule.c:486 has used PyExc_RuntimeError since 3.8.1 (commit bea33f5), but the C-API doc was never updated. Align it with both the code and Doc/library/sys.rst.
1 parent c3ce8cc commit 251e0dc

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

Doc/c-api/sys.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,12 @@ accessible to C code. They all work with the current interpreter thread's
433433
This function is safe to call before :c:func:`Py_Initialize`. When called
434434
after runtime initialization, existing audit hooks are notified and may
435435
silently abort the operation by raising an error subclassed from
436-
:class:`Exception` (other errors will not be silenced).
436+
:class:`RuntimeError` (other errors will not be silenced).
437+
438+
.. versionchanged:: 3.8.1
439+
440+
Exceptions derived from :class:`Exception` but not :class:`RuntimeError`
441+
are no longer suppressed.
437442
438443
The hook function is always called with an :term:`attached thread state` by
439444
the Python interpreter that raised the event.
@@ -447,7 +452,7 @@ accessible to C code. They all work with the current interpreter thread's
447452
448453
If the interpreter is initialized, this function raises an auditing event
449454
``sys.addaudithook`` with no arguments. If any existing hooks raise an
450-
exception derived from :class:`Exception`, the new hook will not be
455+
exception derived from :class:`RuntimeError`, the new hook will not be
451456
added and the exception is cleared. As a result, callers cannot assume
452457
that their hook has been added unless they control all existing hooks.
453458

0 commit comments

Comments
 (0)