This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Dutcho
Recipients Dutcho
Date 2022-04-01.18:47:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1648838826.48.0.057451572293.issue47192@roundup.psfhosted.org>
In-reply-to
Content
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 ()
```
History
Date User Action Args
2022-04-01 18:47:06Dutchosetrecipients: + Dutcho
2022-04-01 18:47:06Dutchosetmessageid: <1648838826.48.0.057451572293.issue47192@roundup.psfhosted.org>
2022-04-01 18:47:06Dutcholinkissue47192 messages
2022-04-01 18:47:06Dutchocreate