]> granicus.if.org Git - python/commitdiff
bpo-36974: remove _PyObject_HasFastCall (GH-13460)
authorJeroen Demeyer <J.Demeyer@UGent.be>
Thu, 30 May 2019 10:43:59 +0000 (12:43 +0200)
committerPetr Viktorin <encukou@gmail.com>
Thu, 30 May 2019 10:43:58 +0000 (12:43 +0200)
Include/cpython/abstract.h
Modules/_functoolsmodule.c
Objects/call.c

index 7099178f82087dedf12f3ba19dc2b5ef0a62e691..7ab2045923d83de03eef5cf6aeed503129f67024 100644 (file)
@@ -55,10 +55,6 @@ PyAPI_FUNC(int) _PyStack_UnpackDict(
    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);
index 13f2db939bb78ac08aa2adfdd686dacebb306e01..213fb3ea336c5a0cc740e7a9746238d733eca272 100644 (file)
@@ -107,7 +107,7 @@ partial_new(PyTypeObject *type, PyObject *args, PyObject *kw)
         return NULL;
     }
 
-    pto->use_fastcall = _PyObject_HasFastCall(func);
+    pto->use_fastcall = (_PyVectorcall_Function(func) != NULL);
 
     return (PyObject *)pto;
 }
@@ -365,7 +365,7 @@ partial_setstate(partialobject *pto, PyObject *state)
         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);
index 183a5c2e5a24ff6947019aa2c4dff3f1e551e42c..55dfc520f1deb1bd6732083ae4042c3af1e73e26 100644 (file)
@@ -9,22 +9,6 @@ static PyObject *
 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)
 {