Skip to content

Commit 0456df4

Browse files
jdemeyermethane
authored andcommitted
bpo-37231: remove _PyObject_FastCall_Prepend (GH-14153)
1 parent c034b78 commit 0456df4

File tree

2 files changed

+0
-42
lines changed

2 files changed

+0
-42
lines changed

Include/cpython/abstract.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,6 @@ PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend(
156156
PyObject *args,
157157
PyObject *kwargs);
158158

159-
PyAPI_FUNC(PyObject *) _PyObject_FastCall_Prepend(
160-
PyObject *callable,
161-
PyObject *obj,
162-
PyObject *const *args,
163-
Py_ssize_t nargs);
164-
165159
/* Like PyObject_CallMethod(), but expect a _Py_Identifier*
166160
as the method name. */
167161
PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *obj,

Objects/call.c

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -837,42 +837,6 @@ PyObject_CallObject(PyObject *callable, PyObject *args)
837837
}
838838

839839

840-
/* Positional arguments are obj followed by args:
841-
call callable(obj, *args, **kwargs) */
842-
PyObject *
843-
_PyObject_FastCall_Prepend(PyObject *callable, PyObject *obj,
844-
PyObject *const *args, Py_ssize_t nargs)
845-
{
846-
PyObject *small_stack[_PY_FASTCALL_SMALL_STACK];
847-
PyObject **args2;
848-
PyObject *result;
849-
850-
nargs++;
851-
if (nargs <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) {
852-
args2 = small_stack;
853-
}
854-
else {
855-
args2 = PyMem_Malloc(nargs * sizeof(PyObject *));
856-
if (args2 == NULL) {
857-
PyErr_NoMemory();
858-
return NULL;
859-
}
860-
}
861-
862-
/* use borrowed references */
863-
args2[0] = obj;
864-
if (nargs > 1) {
865-
memcpy(&args2[1], args, (nargs - 1) * sizeof(PyObject *));
866-
}
867-
868-
result = _PyObject_FastCall(callable, args2, nargs);
869-
if (args2 != small_stack) {
870-
PyMem_Free(args2);
871-
}
872-
return result;
873-
}
874-
875-
876840
/* Call callable(obj, *args, **kwargs). */
877841
PyObject *
878842
_PyObject_Call_Prepend(PyObject *callable,

0 commit comments

Comments
 (0)