[issue42800] Traceback objects allow accessing frame objects without triggering audit hooks

Ryan Hileman report at bugs.python.org
Thu Jan 21 04:22:02 EST 2021


Ryan Hileman <lunixbochs at gmail.com> added the comment:

I just found out that generator object variants have their own code attributes. I investigated the stdlib usage and it seems to be for debug / dis only, so adding these attributes shouldn't impact performance.

I updated the PR to now cover the following attributes:

PyTracebackObject.tb_frame
PyFrameObject.f_code
PyGenObject.gi_code
PyCoroObject.cr_code
PyAsyncGenObject.ag_code

I have also attached a `check_hooks.py` file which allows for quick visual inspection that all of the hooks are working (It prints each attribute name, then accesses it. Expected output is an AUDIT line after each attribute printed.)

----------
Added file: https://bugs.python.org/file49755/check_hooks.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42800>
_______________________________________


More information about the Python-bugs-list mailing list