mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
bpo-36842: Implement PEP 578 (GH-12613)
Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
This commit is contained in:
parent
e788057a91
commit
b82e17e626
70 changed files with 3565 additions and 1816 deletions
|
@ -9,8 +9,10 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#include "cpython/coreconfig.h"
|
||||
#include "fileobject.h"
|
||||
#include "pystate.h"
|
||||
#include "pythread.h"
|
||||
#include "sysmodule.h"
|
||||
|
||||
#include "pycore_gil.h" /* _gil_runtime_state */
|
||||
#include "pycore_pathconfig.h"
|
||||
|
@ -131,6 +133,8 @@ struct _is {
|
|||
uint64_t tstate_next_unique_id;
|
||||
|
||||
struct _warnings_runtime_state warnings;
|
||||
|
||||
PyObject *audit_hooks;
|
||||
};
|
||||
|
||||
PyAPI_FUNC(struct _is*) _PyInterpreterState_LookUpID(PY_INT64_T);
|
||||
|
@ -154,6 +158,13 @@ struct _xidregitem {
|
|||
struct _xidregitem *next;
|
||||
};
|
||||
|
||||
/* runtime audit hook state */
|
||||
|
||||
typedef struct _Py_AuditHookEntry {
|
||||
struct _Py_AuditHookEntry *next;
|
||||
Py_AuditHookFunction hookCFunction;
|
||||
void *userData;
|
||||
} _Py_AuditHookEntry;
|
||||
|
||||
/* GIL state */
|
||||
|
||||
|
@ -224,6 +235,11 @@ typedef struct pyruntimestate {
|
|||
struct _gilstate_runtime_state gilstate;
|
||||
|
||||
_PyPreConfig preconfig;
|
||||
|
||||
Py_OpenCodeHookFunction open_code_hook;
|
||||
void *open_code_userdata;
|
||||
_Py_AuditHookEntry *audit_hook_head;
|
||||
|
||||
// XXX Consolidate globals found via the check-c-globals script.
|
||||
} _PyRuntimeState;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue