5
5
Operating System Utilities
6
6
==========================
7
7
8
+
8
9
.. c :function :: PyObject* PyOS_FSPath (PyObject *path)
9
10
10
11
Return the file system representation for *path *. If the object is a
@@ -97,27 +98,30 @@ Operating System Utilities
97
98
98
99
.. c :function :: int PyOS_CheckStack ()
99
100
101
+ .. index:: single: USE_STACKCHECK (C macro)
102
+
100
103
Return true when the interpreter runs out of stack space. This is a reliable
101
- check, but is only available when :c:macro:`USE_STACKCHECK` is defined (currently
104
+ check, but is only available when :c:macro:`! USE_STACKCHECK` is defined (currently
102
105
on certain versions of Windows using the Microsoft Visual C++ compiler).
103
- :c:macro:`USE_STACKCHECK` will be defined automatically; you should never
106
+ :c:macro:`! USE_STACKCHECK` will be defined automatically; you should never
104
107
change the definition in your own code.
105
108
106
109
110
+ .. c :type :: void (*PyOS_sighandler_t)(int )
111
+
112
+
107
113
.. c :function :: PyOS_sighandler_t PyOS_getsig (int i)
108
114
109
115
Return the current signal handler for signal *i*. This is a thin wrapper around
110
116
either :c:func:`!sigaction` or :c:func:`!signal`. Do not call those functions
111
- directly! :c:type:`PyOS_sighandler_t` is a typedef alias for :c:expr:`void
112
- (\* )(int)`.
117
+ directly!
113
118
114
119
115
120
.. c:function:: PyOS_sighandler_t PyOS_setsig(int i, PyOS_sighandler_t h)
116
121
117
122
Set the signal handler for signal *i* to be *h*; return the old signal handler.
118
123
This is a thin wrapper around either :c:func: `!sigaction ` or :c:func: `!signal `. Do
119
- not call those functions directly! :c:type: `PyOS_sighandler_t ` is a typedef
120
- alias for :c:expr: `void (\* )(int) `.
124
+ not call those functions directly!
121
125
122
126
.. c :function :: wchar_t * Py_DecodeLocale (const char* arg, size_t *size)
123
127
@@ -342,10 +346,8 @@ accessible to C code. They all work with the current interpreter thread's
342
346
silently abort the operation by raising an error subclassed from
343
347
:class: `Exception ` (other errors will not be silenced).
344
348
345
- The hook function is of type :c:expr:`int (*)(const char *event, PyObject
346
- *args, void *userData)`, where *args * is guaranteed to be a
347
- :c:type: `PyTupleObject `. The hook function is always called with the GIL
348
- held by the Python interpreter that raised the event.
349
+ The hook function is always called with the GIL held by the Python
350
+ interpreter that raised the event.
349
351
350
352
See :pep:`578` for a detailed description of auditing. Functions in the
351
353
runtime and standard library that raise events are listed in the
@@ -354,12 +356,21 @@ accessible to C code. They all work with the current interpreter thread's
354
356
355
357
.. audit-event:: sys.addaudithook "" c.PySys_AddAuditHook
356
358
357
- If the interpreter is initialized, this function raises a auditing event
359
+ If the interpreter is initialized, this function raises an auditing event
358
360
``sys.addaudithook`` with no arguments. If any existing hooks raise an
359
361
exception derived from :class:`Exception`, the new hook will not be
360
362
added and the exception is cleared. As a result, callers cannot assume
361
363
that their hook has been added unless they control all existing hooks.
362
364
365
+ .. c:namespace:: NULL
366
+ .. c:type:: int (*Py_AuditHookFunction) (const char *event, PyObject *args, void *userData)
367
+
368
+ The type of the hook function.
369
+ *event * is the C string event argument passed to :c:func: `PySys_Audit ` or
370
+ :c:func: `PySys_AuditTuple `.
371
+ *args * is guaranteed to be a :c:type: `PyTupleObject `.
372
+ *userData * is the argument passed to PySys_AddAuditHook().
373
+
363
374
.. versionadded :: 3.8
364
375
365
376
0 commit comments