@@ -309,7 +309,7 @@ accessible to C code. They all work with the current interpreter thread's
309
309
310
310
.. c:function:: int PySys_Audit(const char *event, const char *format, ...)
311
311
312
- Raises an auditing event with any active hooks. Returns zero for success
312
+ Raise an auditing event with any active hooks. Return zero for success
313
313
and non-zero with an exception set on failure.
314
314
315
315
If any hooks have been added, *format * and other arguments will be used
@@ -327,11 +327,16 @@ accessible to C code. They all work with the current interpreter thread's
327
327
328
328
.. c:function:: int PySys_AddAuditHook(Py_AuditHookFunction hook, void *userData)
329
329
330
- Adds to the collection of active auditing hooks. Returns zero for success
331
- and non-zero on failure. If the runtime has been initialized, also sets an
330
+ Append the callable *hook * to the list of active auditing hooks.
331
+ Return zero for success
332
+ and non-zero on failure. If the runtime has been initialized, also set an
332
333
error on failure. Hooks added through this API are called for all
333
334
interpreters created by the runtime.
334
335
336
+ The *userData * pointer is passed into the hook function. Since hook
337
+ functions may be called from different runtimes, this pointer should not
338
+ refer directly to Python state.
339
+
335
340
This function is safe to call before :c:func: `Py_Initialize `. When called
336
341
after runtime initialization, existing audit hooks are notified and may
337
342
silently abort the operation by raising an error subclassed from
@@ -342,14 +347,10 @@ accessible to C code. They all work with the current interpreter thread's
342
347
:c:type: `PyTupleObject `. The hook function is always called with the GIL
343
348
held by the Python interpreter that raised the event.
344
349
345
- The *userData * pointer is passed into the hook function. Since hook
346
- functions may be called from different runtimes, this pointer should not
347
- refer directly to Python state.
348
-
349
- See :pep: `578 ` for a detailed description of auditing. Functions in the
350
- runtime and standard library that raise events include the details in each
351
- function's documentation and listed in the :ref: `audit events table
352
- <audit-events>`.
350
+ See :pep: `578 ` for a detailed description of auditing. Functions in the
351
+ runtime and standard library that raise events are listed in the
352
+ :ref: `audit events table <audit-events >`.
353
+ Details are in each function's documentation.
353
354
354
355
.. audit-event :: sys.addaudithook "" c.PySys_AddAuditHook
355
356
0 commit comments