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:
Steve Dower 2021-05-03 14:06:36 +01:00 committed by GitHub
parent 1536342c44
commit bb2f3ff7a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 9 deletions

View file

@ -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)