Skip to content

Commit

Permalink
CPython shouldn't specialize function calls with custom _PyFunction_V…
Browse files Browse the repository at this point in the history
…ectorcall

Summary:
CPython includes a check in the interpreter loop to not go through vectorcall if it's been customized. But it'll specialize these method calls, and then avoid the custom hook.

It should refuse to specialize if the hook has been set.

Reviewed By: alexmalyshev

Differential Revision: D67505322

fbshipit-source-id: 8bc9c26b961e168113d0d23a6a40e653f4f0997c
  • Loading branch information
DinoV authored and facebook-github-bot committed Dec 20, 2024
1 parent 4f3babd commit 987cf2d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Python/specialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -1678,6 +1678,9 @@ specialize_py_call(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs,
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_PEP_523);
return -1;
}
if (func->vectorcall != _PyFunction_Vectorcall) {
return -1;
}
if (kwnames) {
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_KWNAMES);
return -1;
Expand Down

0 comments on commit 987cf2d

Please sign in to comment.