You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sys._getframe audit event has frame as argument in 3.8-3.10 #91348
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2022-04-01.18:47:06.469>labels= ['3.8', '3.9', '3.10', '3.11']
title='sys._getframe audit event has frame as argument in 3.8-3.10'updated_at=<Date2022-04-02.13:14:53.178>user='https://github.com/Dutcho'
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 should be fixed in the docs and also in 3.11. Now that we've shipped releases that include the frame, we should keep doing it.
If it's impossible to get a frame object in 3.11 (because it would deoptimize all the work that's been done there), it should pass None. Changing the value of the argument is fine, but changing the schema is not.
Activity
Dutcho commentedon Apr 1, 2022
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.pyin various versions:
zooba commentedon Apr 2, 2022
This should be fixed in the docs and also in 3.11. Now that we've shipped releases that include the frame, we should keep doing it.
If it's impossible to get a frame object in 3.11 (because it would deoptimize all the work that's been done there), it should pass None. Changing the value of the argument is fine, but changing the schema is not.
pythongh-91348: Restore frame argument to sys._getframe audit event
gh-91348: Restore frame argument to sys._getframe audit event (GH-94928)
pythongh-91348: Restore frame argument to sys._getframe audit event (p…
gh-91348: Restore frame argument to sys._getframe audit event (GH-94928)