mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
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
This commit is contained in:
parent
1536342c44
commit
bb2f3ff7a8
8 changed files with 22 additions and 9 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -5044,6 +5044,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
|
||||
|
|
|
|||
|
|
@ -1005,6 +1005,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)
|
||||
|
|
@ -1089,6 +1092,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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue