8000 Use CALL_NON_PY_GENERAL in more cases when otherwise failing to speci… · python/cpython@dce9b23 · GitHub
[go: up one dir, main page]

Skip to content

Commit dce9b23

Browse files
committed
Use CALL_NON_PY_GENERAL in more cases when otherwise failing to specialize
1 parent 5ee0129 commit dce9b23

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Python/specialize.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,8 +1789,7 @@ specialize_class_call(PyObject *callable, _Py_CODEUNIT *instr, int nargs)
17891789
return -1;
17901790
}
17911791
if (Py_TYPE(tp) != &PyType_Type) {
1792-
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_METACLASS);
1793-
return -1;
1792+
goto generic;
17941793
}
17951794
if (tp->tp_new == PyBaseObject_Type.tp_new) {
17961795
PyFunctionObject *init = get_init_for_simple_managed_python_class(tp);
@@ -1807,10 +1806,10 @@ specialize_class_call(PyObject *callable, _Py_CODEUNIT *instr, int nargs)
18071806
_Py_SET_OPCODE(*instr, CALL_ALLOC_AND_ENTER_INIT);
18081807
return 0;
18091808
}
1810-
return -1;
18111809
}
1812-
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_CLASS_MUTABLE);
1813-
return -1;
1810+
generic:
1811+
instr->op.code = CALL_NON_PY_GENERAL;
1812+
return 0;
18141813
}
18151814

18161815
#ifdef Py_STATS
@@ -1901,8 +1900,8 @@ specialize_method_descriptor(PyMethodDescrObject *descr, _Py_CODEUNIT *instr,
19011900
return 0;
19021901
}
19031902
}
1904-
SPECIALIZATION_FAIL(CALL, meth_descr_call_fail_kind(descr->d_method->ml_flags));
1905-
return -1;
1903+
instr->op.code = CALL_NON_PY_GENERAL;
1904+
return 0;
19061905
}
19071906

19081907
static int
@@ -1936,7 +1935,6 @@ specialize_py_call(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs,
19361935
}
19371936
else {
19381937
instr->op.code = bound_method ? CALL_BOUND_METHOD_GENERAL : CALL_PY_GENERAL;
1939-
return 0;
19401938
}
19411939
return 0;
19421940
}
@@ -1945,6 +1943,7 @@ static int
19451943
specialize_c_call(PyObject *callable, _Py_CODEUNIT *instr, int nargs)
19461944
{
19471945
if (PyCFunction_GET_FUNCTION(callable) == NULL) {
1946+
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_OTHER);
19481947
return 1;
19491948
}
19501949
switch (PyCFunction_GET_FLAGS(callable) &

0 commit comments

Comments
 (0)
0