From fceef0881f60166bbf0705d36cb7062de748387d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristi=C3=A1n=20Maureira-Fredes?= Date: Sat, 14 Jan 2023 19:04:27 +0100 Subject: [PATCH] Fix ctypes typo set_exception Found this while translating the documentation to Spanish --- Doc/library/ctypes.rst | 4 ++-- Modules/_ctypes/callproc.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index ac533a939d6ac2..50ab2937562355 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -1656,12 +1656,12 @@ They are instances of a private class: passed arguments. -.. audit-event:: ctypes.seh_exception code foreign-functions +.. audit-event:: ctypes.set_exception code foreign-functions On Windows, when a foreign function call raises a system exception (for example, due to an access violation), it will be captured and replaced with a suitable Python exception. Further, an auditing event - ``ctypes.seh_exception`` with argument ``code`` will be raised, allowing an + ``ctypes.set_exception`` with argument ``code`` will be raised, allowing an audit hook to replace the exception with its own. .. audit-event:: ctypes.call_function func_pointer,arguments foreign-functions diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index 1958758dd0cf0b..f6d98bbeebc24e 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -286,7 +286,7 @@ static WCHAR *FormatError(DWORD code) #ifndef DONT_USE_SEH static void SetException(DWORD code, EXCEPTION_RECORD *pr) { - if (PySys_Audit("ctypes.seh_exception", "I", code) < 0) { + if (PySys_Audit("ctypes.set_exception", "I", code) < 0) { /* An exception was set by the audit hook */ return; }