bpo-36974: remove _PyObject_HasFastCall (GH-13460) · python/cpython@c145f3b

3 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -55,10 +55,6 @@ PyAPI_FUNC(int) _PyStack_UnpackDict(

5555

40 bytes on the stack. */

5656

#define _PY_FASTCALL_SMALL_STACK 5

5757
58-

/* Return 1 if callable supports FASTCALL calling convention for positional

59-

arguments: see _PyObject_Vectorcall() and _PyObject_FastCallDict() */

60-

PyAPI_FUNC(int) _PyObject_HasFastCall(PyObject *callable);

61-
6258

PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *callable,

6359

PyObject *result,

6460

const char *where);

Original file line numberDiff line numberDiff line change

@@ -107,7 +107,7 @@ partial_new(PyTypeObject *type, PyObject *args, PyObject *kw)

107107

return NULL;

108108

}

109109
110-

pto->use_fastcall = _PyObject_HasFastCall(func);

110+

pto->use_fastcall = (_PyVectorcall_Function(func) != NULL);

111111
112112

return (PyObject *)pto;

113113

}

@@ -365,7 +365,7 @@ partial_setstate(partialobject *pto, PyObject *state)

365365

Py_INCREF(dict);

366366
367367

Py_INCREF(fn);

368-

pto->use_fastcall = _PyObject_HasFastCall(fn);

368+

pto->use_fastcall = (_PyVectorcall_Function(fn) != NULL);

369369

Py_SETREF(pto->fn, fn);

370370

Py_SETREF(pto->args, fnargs);

371371

Py_SETREF(pto->kw, kw);

Original file line numberDiff line numberDiff line change

@@ -9,22 +9,6 @@ static PyObject *

99

cfunction_call_varargs(PyObject *func, PyObject *args, PyObject *kwargs);

1010
1111
12-

int

13-

_PyObject_HasFastCall(PyObject *callable)

14-

{

15-

if (PyFunction_Check(callable)) {

16-

return 1;

17-

}

18-

else if (PyCFunction_Check(callable)) {

19-

return !(PyCFunction_GET_FLAGS(callable) & METH_VARARGS);

20-

}

21-

else {

22-

assert (PyCallable_Check(callable));

23-

return 0;

24-

}

25-

}

26-
27-
2812

static PyObject *

2913

null_error(void)

3014

{