mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-42800: add audit hooks for f_code and tb_frame (GH-24182)
Accessing the following attributes will now fire PEP 578 style audit hooks as ("object.__getattr__", obj, name): * PyTracebackObject: tb_frame * PyFrameObject: f_code * PyGenObject: gi_code, gi_frame * PyCoroObject: cr_code, cr_frame * PyAsyncGenObject: ag_code, ag_frame Add an AUDIT_READ attribute flag aliased to READ_RESTRICTED. Update obsolete flag documentation.
This commit is contained in:
parent
088a15c49d
commit
9a2c2a9ec3
11 changed files with 32 additions and 15 deletions
|
@ -741,8 +741,8 @@ static PyGetSetDef gen_getsetlist[] = {
|
|||
};
|
||||
|
||||
static PyMemberDef gen_memberlist[] = {
|
||||
{"gi_frame", T_OBJECT, offsetof(PyGenObject, gi_frame), READONLY},
|
||||
{"gi_code", T_OBJECT, offsetof(PyGenObject, gi_code), READONLY},
|
||||
{"gi_frame", T_OBJECT, offsetof(PyGenObject, gi_frame), READONLY|AUDIT_READ},
|
||||
{"gi_code", T_OBJECT, offsetof(PyGenObject, gi_code), READONLY|AUDIT_READ},
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
@ -978,8 +978,8 @@ static PyGetSetDef coro_getsetlist[] = {
|
|||
};
|
||||
|
||||
static PyMemberDef coro_memberlist[] = {
|
||||
{"cr_frame", T_OBJECT, offsetof(PyCoroObject, cr_frame), READONLY},
|
||||
{"cr_code", T_OBJECT, offsetof(PyCoroObject, cr_code), READONLY},
|
||||
{"cr_frame", T_OBJECT, offsetof(PyCoroObject, cr_frame), READONLY|AUDIT_READ},
|
||||
{"cr_code", T_OBJECT, offsetof(PyCoroObject, cr_code), READONLY|AUDIT_READ},
|
||||
{"cr_origin", T_OBJECT, offsetof(PyCoroObject, cr_origin), READONLY},
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
@ -1360,10 +1360,10 @@ static PyGetSetDef async_gen_getsetlist[] = {
|
|||
};
|
||||
|
||||
static PyMemberDef async_gen_memberlist[] = {
|
||||
{"ag_frame", T_OBJECT, offsetof(PyAsyncGenObject, ag_frame), READONLY},
|
||||
{"ag_frame", T_OBJECT, offsetof(PyAsyncGenObject, ag_frame), READONLY|AUDIT_READ},
|
||||
{"ag_running", T_BOOL, offsetof(PyAsyncGenObject, ag_running_async),
|
||||
READONLY},
|
||||
{"ag_code", T_OBJECT, offsetof(PyAsyncGenObject, ag_code), READONLY},
|
||||
{"ag_code", T_OBJECT, offsetof(PyAsyncGenObject, ag_code), READONLY|AUDIT_READ},
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue