GH-113710: Fix optimization of globals using _CHECK_FUNCTION (GH-116460)

This commit is contained in:
Mark Shannon 2024-03-08 09:47:41 +00:00 committed by GitHub
parent 0b647141d5
commit 0003285c8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 10 deletions

View file

@ -3829,8 +3829,9 @@
}
case _CHECK_FUNCTION: {
PyObject *func = (PyObject *)CURRENT_OPERAND();
if (frame->f_funcobj != func) goto deoptimize;
uint32_t func_version = (uint32_t)CURRENT_OPERAND();
assert(PyFunction_Check(frame->f_funcobj));
if (((PyFunctionObject *)frame->f_funcobj)->func_version != func_version) goto deoptimize;
break;
}