[New-bugs-announce] [issue47192] sys._getframe audit event has frame as argument in 3.8-3.10
Dutcho
report at bugs.python.org
Fri Apr 1 14:47:06 EDT 2022
New submission from Dutcho <dutcho at ziggo.nl>:
Documentation (https://docs.python.org/3/library/audit_events.html and https://docs.python.org/3/library/sys.html#sys._getframe) states that `sys._getframe()` "raises [...] an auditing event with no arguments".
However, Python 3.8-3.10 provide the frame as argument to the hook function. Python 3.11 behaves consistently with documentation.
But I couldn't find the change mentioned in the change log. Therefore, I'm uncertain whether that's intentional or not, so whether it'll remain in the release version.
This is demonstrated by running snippet `audit.py`
```
import sys
sys.addaudithook(print)
print(sys.version)
sys._getframe()
```
in various versions:
```
3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]
sys._getframe (<frame at 0x00000209AD68C440, file 'audit.py', line 4, code <module>>,)
3.9.11 (tags/v3.9.11:2de452f, Mar 16 2022, 14:33:45) [MSC v.1929 64 bit (AMD64)]
sys._getframe (<frame at 0x00000199B7593FD0, file 'C:\\Users\\...\\audit.py', line 4, code <module>>,)
3.10.3 (tags/v3.10.3:a342a49, Mar 16 2022, 13:07:40) [MSC v.1929 64 bit (AMD64)]
sys._getframe (<frame at 0x00000210B95E9C40, file 'C:\\Users\\...\\audit.py', line 4, code <module>>,)
3.11.0a6 (main, Mar 7 2022, 16:46:19) [MSC v.1929 64 bit (AMD64)]
sys._getframe ()
```
----------
messages: 416506
nosy: Dutcho
priority: normal
severity: normal
status: open
title: sys._getframe audit event has frame as argument in 3.8-3.10
versions: Python 3.10, Python 3.8, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47192>
_______________________________________
More information about the New-bugs-announce
mailing list