bpo-36974: remove _PyObject_HasFastCall (GH-13460)
diff --git a/Include/cpython/abstract.h b/Include/cpython/abstract.h
index 7099178..7ab2045 100644
--- a/Include/cpython/abstract.h
+++ b/Include/cpython/abstract.h
@@ -55,10 +55,6 @@
40 bytes on the stack. */
#define _PY_FASTCALL_SMALL_STACK 5
-/* Return 1 if callable supports FASTCALL calling convention for positional
- arguments: see _PyObject_Vectorcall() and _PyObject_FastCallDict() */
-PyAPI_FUNC(int) _PyObject_HasFastCall(PyObject *callable);
-
PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *callable,
PyObject *result,
const char *where);
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index 13f2db9..213fb3e 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -107,7 +107,7 @@
return NULL;
}
- pto->use_fastcall = _PyObject_HasFastCall(func);
+ pto->use_fastcall = (_PyVectorcall_Function(func) != NULL);
return (PyObject *)pto;
}
@@ -365,7 +365,7 @@
Py_INCREF(dict);
Py_INCREF(fn);
- pto->use_fastcall = _PyObject_HasFastCall(fn);
+ pto->use_fastcall = (_PyVectorcall_Function(fn) != NULL);
Py_SETREF(pto->fn, fn);
Py_SETREF(pto->args, fnargs);
Py_SETREF(pto->kw, kw);
diff --git a/Objects/call.c b/Objects/call.c
index 183a5c2..55dfc52 100644
--- a/Objects/call.c
+++ b/Objects/call.c
@@ -9,22 +9,6 @@
cfunction_call_varargs(PyObject *func, PyObject *args, PyObject *kwargs);
-int
-_PyObject_HasFastCall(PyObject *callable)
-{
- if (PyFunction_Check(callable)) {
- return 1;
- }
- else if (PyCFunction_Check(callable)) {
- return !(PyCFunction_GET_FLAGS(callable) & METH_VARARGS);
- }
- else {
- assert (PyCallable_Check(callable));
- return 0;
- }
-}
-
-
static PyObject *
null_error(void)
{