diff options
author | Ryan Hileman <lunixbochs@gmail.com> | 2021-04-29 23:15:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-29 23:15:55 (GMT) |
commit | 9a2c2a9ec3140b6c54c9ef9d994311f114128ee3 (patch) | |
tree | fbc87fa594de1ab3f8151dc74786add7eac3e1b3 /Doc/extending | |
parent | 088a15c49d99ecb4c3bef93f8f40dd513c6cae3b (diff) | |
download | cpython-9a2c2a9ec3140b6c54c9ef9d994311f114128ee3.zip cpython-9a2c2a9ec3140b6c54c9ef9d994311f114128ee3.tar.gz cpython-9a2c2a9ec3140b6c54c9ef9d994311f114128ee3.tar.bz2 |
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.
Diffstat (limited to 'Doc/extending')
-rw-r--r-- | Doc/extending/newtypes.rst | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst index c078476..545390c 100644 --- a/Doc/extending/newtypes.rst +++ b/Doc/extending/newtypes.rst @@ -287,18 +287,23 @@ combined using bitwise-OR. +===========================+==============================================+ | :const:`READONLY` | Never writable. | +---------------------------+----------------------------------------------+ -| :const:`READ_RESTRICTED` | Not readable in restricted mode. | -+---------------------------+----------------------------------------------+ -| :const:`WRITE_RESTRICTED` | Not writable in restricted mode. | -+---------------------------+----------------------------------------------+ -| :const:`RESTRICTED` | Not readable or writable in restricted mode. | +| :const:`AUDIT_READ` | Emit an ``object.__getattr__`` | +| | :ref:`audit events <audit-events>` before | +| | reading. | +---------------------------+----------------------------------------------+ +.. versionchanged:: 3.10 + :const:`RESTRICTED`, :const:`READ_RESTRICTED` and :const:`WRITE_RESTRICTED` + are deprecated. However, :const:`READ_RESTRICTED` is an alias for + :const:`AUDIT_READ`, so fields that specify either :const:`RESTRICTED` or + :const:`READ_RESTRICTED` will also raise an audit event. + .. index:: single: READONLY single: READ_RESTRICTED single: WRITE_RESTRICTED single: RESTRICTED + single: AUDIT_READ 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 |