Skip to content

Commit 987cf2d

Browse files
DinoVfacebook-github-bot
authored andcommitted
CPython shouldn't specialize function calls with custom _PyFunction_Vectorcall
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
1 parent 4f3babd commit 987cf2d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Python/specialize.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,9 @@ specialize_py_call(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs,
16781678
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_PEP_523);
16791679
return -1;
16801680
}
1681+
if (func->vectorcall != _PyFunction_Vectorcall) {
1682+
return -1;
1683+
}
16811684
if (kwnames) {
16821685
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_KWNAMES);
16831686
return -1;

0 commit comments

Comments
 (0)