Skip to content

Commit 4e30d66

Browse files
committed
Don't specialize functions which have a modified vectorcall
1 parent 4e7e2dd commit 4e30d66

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Python/specialize.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,7 @@ _PyCode_Quicken(_Py_CODEUNIT *instructions, Py_ssize_t size, int enable_counters
630630
#define SPEC_FAIL_CALL_INIT_NOT_PYTHON 21
631631
#define SPEC_FAIL_CALL_PEP_523 22
632632
#define SPEC_FAIL_CALL_BOUND_METHOD 23
633+
#define SPEC_FAIL_CALL_VECTORCALL 24
633634
#define SPEC_FAIL_CALL_CLASS_MUTABLE 26
634635
#define SPEC_FAIL_CALL_METHOD_WRAPPER 28
635636
#define SPEC_FAIL_CALL_OPERATOR_WRAPPER 29
@@ -2071,6 +2072,10 @@ specialize_py_call(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs,
20712072
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_PEP_523);
20722073
return -1;
20732074
}
2075+
if (func->vectorcall != _PyFunction_Vectorcall) {
2076+
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_VECTORCALL);
2077+
return -1;
2078+
}
20742079
int argcount = -1;
20752080
if (kind == SPEC_FAIL_CODE_NOT_OPTIMIZED) {
20762081
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CODE_NOT_OPTIMIZED);
@@ -2110,6 +2115,10 @@ specialize_py_call_kw(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs,
21102115
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_PEP_523);
21112116
return -1;
21122117
}
2118+
if (func->vectorcall != _PyFunction_Vectorcall) {
2119+
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_VECTORCALL);
2120+
return -1;
2121+
}
21132122
if (kind == SPEC_FAIL_CODE_NOT_OPTIMIZED) {
21142123
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CODE_NOT_OPTIMIZED);
21152124
return -1;

0 commit comments

Comments
 (0)