Skip to content

Conversation

@markshannon
Copy link
Member

@markshannonmarkshannon commented Mar 7, 2024

#116410 added an obvious bug: I didn't update the pointers used.
But there is more subtle bug: Using pointers rather than version numbers risks a new function appearing to be the old one.

This PR fixes both bugs.

@Fidget-Spinner
Copy link
Member

lgtm but I will wait for Guido to review too

assert(((PyFunctionObject *)frame->f_funcobj)->func_globals == globals);
PyFunctionObject *function = (PyFunctionObject *)frame->f_funcobj;
assert(PyFunction_Check(function));
assert(function->func_builtins == builtins);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: these are read-only attributes so this precondition should hold.

Copy link
Member

@gvanrossumgvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@markshannonmarkshannon merged commit 0003285 into python:mainMar 8, 2024
@markshannonmarkshannon deleted the fix-check-function branch August 6, 2024 10:18
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@markshannon@Fidget-Spinner@gvanrossum@brandtbucher