Skip to content

Commit 9615662

Browse files
DinoVmeta-codesync[bot]
authored andcommitted
Add patch 'specialize-check-vectorcall'
Summary: This diff adds a patch to the `3.14` Meta-internal fork. Check vectorcall on functions before specializing - this is already upstreamed to `main`. Reviewed By: itamaro Differential Revision: D83786157 fbshipit-source-id: 545d0e4cdff9a41a5e83572d5290ab09eb984241
1 parent cca0814 commit 9615662

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

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
@@ -2078,6 +2079,10 @@ specialize_py_call(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs,
20782079
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_PEP_523);
20792080
return -1;
20802081
}
2082+
if (func->vectorcall != _PyFunction_Vectorcall) {
2083+
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_VECTORCALL);
2084+
return -1;
2085+
}
20812086
int argcount = -1;
20822087
if (kind == SPEC_FAIL_CODE_NOT_OPTIMIZED) {
20832088
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CODE_NOT_OPTIMIZED);
@@ -2117,6 +2122,10 @@ specialize_py_call_kw(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs,
21172122
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_PEP_523);
21182123
return -1;
21192124
}
2125+
if (func->vectorcall != _PyFunction_Vectorcall) {
2126+
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_VECTORCALL);
2127+
return -1;
2128+
}
21202129
if (kind == SPEC_FAIL_CODE_NOT_OPTIMIZED) {
21212130
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CODE_NOT_OPTIMIZED);
21222131
return -1;

0 commit comments

Comments
 (0)