-
-
Notifications
You must be signed in to change notification settings - Fork 32k
GH-92239: Respect PEP 523 #92245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-92239: Respect PEP 523 #92245
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks @markshannon !
@@ -1466,6 +1467,11 @@ specialize_py_call(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs, | |||
assert(_Py_OPCODE(*instr) == CALL_ADAPTIVE); | |||
PyCodeObject *code = (PyCodeObject *)func->func_code; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will we want to add a check here for overridden vectorcall
on func
as well, or is it already covered somewhere else? (assuming the vectorcall set API sets the version to zero)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want to check for that in #92257
Lib/test/test_capi.py
Outdated
def test_specialize_before_intercept(self): | ||
def func2(): | ||
pass | ||
for _ in range(SUFFICIENT_TO_SPECIALIZE): | ||
func2() | ||
self.do_test(func2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more for my understanding - this test case fails without the added PEP-523 checks? (but the other one passes?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both tests should fail without the checks.
@@ -4890,6 +4890,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int | |||
|
|||
TARGET(CALL_PY_EXACT_ARGS) { | |||
assert(call_shape.kwnames == NULL); | |||
DEOPT_IF(tstate->interp->eval_frame, CALL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how to verify that these opcodes (CALL_PY_EXACT_ARGS
& CALL_PY_WITH_DEFAULTS
) are the only ones where this check is needed - I trust you :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure that we respect PEP 523 when specializing