diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-05-03 13:24:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-03 13:24:05 (GMT) |
commit | 8ab272f0f3dd7da44f8e21d2a5a39c2ab39490d6 (patch) | |
tree | 29a8e6da76f11c3dba0ace178b7b4372d89a27d6 /Doc | |
parent | 10665ac37313560fe87460cf4a5c26677049bf62 (diff) | |
download | cpython-8ab272f0f3dd7da44f8e21d2a5a39c2ab39490d6.zip cpython-8ab272f0f3dd7da44f8e21d2a5a39c2ab39490d6.tar.gz cpython-8ab272f0f3dd7da44f8e21d2a5a39c2ab39490d6.tar.bz2 |
bpo-42800: Add audit events 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
(cherry picked from commit bb2f3ff7a8f0c3565ccc1946dba7e09a3f7dc209)
Co-authored-by: Steve Dower <steve.dower@python.org>
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/audit_events.rst | 2 | ||||
-rw-r--r-- | Doc/library/stdtypes.rst | 3 | ||||
-rw-r--r-- | Doc/reference/datamodel.rst | 6 |
3 files changed, 10 insertions, 1 deletions
diff --git a/Doc/library/audit_events.rst b/Doc/library/audit_events.rst index 367d56e..8227a79 100644 --- a/Doc/library/audit_events.rst +++ b/Doc/library/audit_events.rst @@ -7,7 +7,7 @@ Audit events table This table contains all events raised by :func:`sys.audit` or :c:func:`PySys_Audit` calls throughout the CPython runtime and the -standard library. These calls were added in 3.8.0 or later. +standard library. These calls were added in 3.8.0 or later (see :pep:`578`). See :func:`sys.addaudithook` and :c:func:`PySys_AddAuditHook` for information on handling these events. diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index fb50050..aaef425 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -4708,6 +4708,9 @@ environment. Code objects are returned by the built-in :func:`compile` function and can be extracted from function objects through their :attr:`__code__` attribute. See also the :mod:`code` module. +Accessing ``__code__`` raises an :ref:`auditing event <auditing>` +``object.__getattr__`` with arguments ``obj`` and ``"__code__"``. + .. index:: builtin: exec builtin: eval diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index f71560d..bf391ef 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1000,6 +1000,9 @@ Internal types :attr:`f_lasti` gives the precise instruction (this is an index into the bytecode string of the code object). + Accessing ``f_code`` raises an :ref:`auditing event <auditing>` + ``object.__getattr__`` with arguments ``obj`` and ``"f_code"``. + .. index:: single: f_trace (frame attribute) single: f_trace_lines (frame attribute) @@ -1084,6 +1087,9 @@ Internal types :keyword:`try` statement with no matching except clause or with a finally clause. + Accessing ``tb_frame`` raises an :ref:`auditing event <auditing>` + ``object.__getattr__`` with arguments ``obj`` and ``"tb_frame"``. + .. index:: single: tb_next (traceback attribute) |