bpo-42800: Rename AUDIT_READ to PY_AUDIT_READ (GH-25736)

This commit is contained in:
Steve Dower 2021-04-30 01:08:55 +01:00 committed by GitHub
parent 9a2c2a9ec3
commit 87655e2cf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 14 deletions

View File

@ -287,7 +287,7 @@ combined using bitwise-OR.
+===========================+==============================================+ +===========================+==============================================+
| :const:`READONLY` | Never writable. | | :const:`READONLY` | Never writable. |
+---------------------------+----------------------------------------------+ +---------------------------+----------------------------------------------+
| :const:`AUDIT_READ` | Emit an ``object.__getattr__`` | | :const:`PY_AUDIT_READ` | Emit an ``object.__getattr__`` |
| | :ref:`audit events <audit-events>` before | | | :ref:`audit events <audit-events>` before |
| | reading. | | | reading. |
+---------------------------+----------------------------------------------+ +---------------------------+----------------------------------------------+
@ -295,15 +295,15 @@ combined using bitwise-OR.
.. versionchanged:: 3.10 .. versionchanged:: 3.10
:const:`RESTRICTED`, :const:`READ_RESTRICTED` and :const:`WRITE_RESTRICTED` :const:`RESTRICTED`, :const:`READ_RESTRICTED` and :const:`WRITE_RESTRICTED`
are deprecated. However, :const:`READ_RESTRICTED` is an alias for are deprecated. However, :const:`READ_RESTRICTED` is an alias for
:const:`AUDIT_READ`, so fields that specify either :const:`RESTRICTED` or :const:`PY_AUDIT_READ`, so fields that specify either :const:`RESTRICTED`
:const:`READ_RESTRICTED` will also raise an audit event. or :const:`READ_RESTRICTED` will also raise an audit event.
.. index:: .. index::
single: READONLY single: READONLY
single: READ_RESTRICTED single: READ_RESTRICTED
single: WRITE_RESTRICTED single: WRITE_RESTRICTED
single: RESTRICTED single: RESTRICTED
single: AUDIT_READ single: PY_AUDIT_READ
An interesting advantage of using the :c:member:`~PyTypeObject.tp_members` table to build An interesting advantage of using the :c:member:`~PyTypeObject.tp_members` table to build
descriptors that are used at runtime is that any attribute defined this way can descriptors that are used at runtime is that any attribute defined this way can

View File

@ -62,7 +62,7 @@ typedef struct PyMemberDef {
#define PY_WRITE_RESTRICTED 4 #define PY_WRITE_RESTRICTED 4
#define RESTRICTED (READ_RESTRICTED | PY_WRITE_RESTRICTED) #define RESTRICTED (READ_RESTRICTED | PY_WRITE_RESTRICTED)
#define AUDIT_READ READ_RESTRICTED #define PY_AUDIT_READ READ_RESTRICTED
/* Current API, use this */ /* Current API, use this */
PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, struct PyMemberDef *); PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, struct PyMemberDef *);

View File

@ -164,7 +164,7 @@ member_get(PyMemberDescrObject *descr, PyObject *obj, PyObject *type)
if (descr_check((PyDescrObject *)descr, obj, &res)) if (descr_check((PyDescrObject *)descr, obj, &res))
return res; return res;
if (descr->d_member->flags & AUDIT_READ) { if (descr->d_member->flags & PY_AUDIT_READ) {
if (PySys_Audit("object.__getattr__", "Os", if (PySys_Audit("object.__getattr__", "Os",
obj ? obj : Py_None, descr->d_member->name) < 0) { obj ? obj : Py_None, descr->d_member->name) < 0) {
return NULL; return NULL;

View File

@ -13,7 +13,7 @@
static PyMemberDef frame_memberlist[] = { static PyMemberDef frame_memberlist[] = {
{"f_back", T_OBJECT, OFF(f_back), READONLY}, {"f_back", T_OBJECT, OFF(f_back), READONLY},
{"f_code", T_OBJECT, OFF(f_code), READONLY|AUDIT_READ}, {"f_code", T_OBJECT, OFF(f_code), READONLY|PY_AUDIT_READ},
{"f_builtins", T_OBJECT, OFF(f_builtins), READONLY}, {"f_builtins", T_OBJECT, OFF(f_builtins), READONLY},
{"f_globals", T_OBJECT, OFF(f_globals), READONLY}, {"f_globals", T_OBJECT, OFF(f_globals), READONLY},
{"f_trace_lines", T_BOOL, OFF(f_trace_lines), 0}, {"f_trace_lines", T_BOOL, OFF(f_trace_lines), 0},

View File

@ -741,8 +741,8 @@ static PyGetSetDef gen_getsetlist[] = {
}; };
static PyMemberDef gen_memberlist[] = { static PyMemberDef gen_memberlist[] = {
{"gi_frame", T_OBJECT, offsetof(PyGenObject, gi_frame), READONLY|AUDIT_READ}, {"gi_frame", T_OBJECT, offsetof(PyGenObject, gi_frame), READONLY|PY_AUDIT_READ},
{"gi_code", T_OBJECT, offsetof(PyGenObject, gi_code), READONLY|AUDIT_READ}, {"gi_code", T_OBJECT, offsetof(PyGenObject, gi_code), READONLY|PY_AUDIT_READ},
{NULL} /* Sentinel */ {NULL} /* Sentinel */
}; };
@ -978,8 +978,8 @@ static PyGetSetDef coro_getsetlist[] = {
}; };
static PyMemberDef coro_memberlist[] = { static PyMemberDef coro_memberlist[] = {
{"cr_frame", T_OBJECT, offsetof(PyCoroObject, cr_frame), READONLY|AUDIT_READ}, {"cr_frame", T_OBJECT, offsetof(PyCoroObject, cr_frame), READONLY|PY_AUDIT_READ},
{"cr_code", T_OBJECT, offsetof(PyCoroObject, cr_code), READONLY|AUDIT_READ}, {"cr_code", T_OBJECT, offsetof(PyCoroObject, cr_code), READONLY|PY_AUDIT_READ},
{"cr_origin", T_OBJECT, offsetof(PyCoroObject, cr_origin), READONLY}, {"cr_origin", T_OBJECT, offsetof(PyCoroObject, cr_origin), READONLY},
{NULL} /* Sentinel */ {NULL} /* Sentinel */
}; };
@ -1360,10 +1360,10 @@ static PyGetSetDef async_gen_getsetlist[] = {
}; };
static PyMemberDef async_gen_memberlist[] = { static PyMemberDef async_gen_memberlist[] = {
{"ag_frame", T_OBJECT, offsetof(PyAsyncGenObject, ag_frame), READONLY|AUDIT_READ}, {"ag_frame", T_OBJECT, offsetof(PyAsyncGenObject, ag_frame), READONLY|PY_AUDIT_READ},
{"ag_running", T_BOOL, offsetof(PyAsyncGenObject, ag_running_async), {"ag_running", T_BOOL, offsetof(PyAsyncGenObject, ag_running_async),
READONLY}, READONLY},
{"ag_code", T_OBJECT, offsetof(PyAsyncGenObject, ag_code), READONLY|AUDIT_READ}, {"ag_code", T_OBJECT, offsetof(PyAsyncGenObject, ag_code), READONLY|PY_AUDIT_READ},
{NULL} /* Sentinel */ {NULL} /* Sentinel */
}; };

View File

@ -147,7 +147,7 @@ static PyMethodDef tb_methods[] = {
}; };
static PyMemberDef tb_memberlist[] = { static PyMemberDef tb_memberlist[] = {
{"tb_frame", T_OBJECT, OFF(tb_frame), READONLY|AUDIT_READ}, {"tb_frame", T_OBJECT, OFF(tb_frame), READONLY|PY_AUDIT_READ},
{"tb_lasti", T_INT, OFF(tb_lasti), READONLY}, {"tb_lasti", T_INT, OFF(tb_lasti), READONLY},
{"tb_lineno", T_INT, OFF(tb_lineno), READONLY}, {"tb_lineno", T_INT, OFF(tb_lineno), READONLY},
{NULL} /* Sentinel */ {NULL} /* Sentinel */