[Python-checkins] bpo-37231: remove _PyObject_FastCall_Prepend (GH-14153)

Inada Naoki webhook-mailer at python.org
Mon Jun 17 07:41:49 EDT 2019


https://github.com/python/cpython/commit/0456df4a55ec9a4e8f4425df92bbe63a290f3f2f
commit: 0456df4a55ec9a4e8f4425df92bbe63a290f3f2f
branch: master
author: Jeroen Demeyer <J.Demeyer at UGent.be>
committer: Inada Naoki <songofacandy at gmail.com>
date: 2019-06-17T20:41:32+09:00
summary:

bpo-37231: remove _PyObject_FastCall_Prepend (GH-14153)

files:
M Include/cpython/abstract.h
M Objects/call.c

diff --git a/Include/cpython/abstract.h b/Include/cpython/abstract.h
index 7ab2045923d8..d0369122287b 100644
--- a/Include/cpython/abstract.h
+++ b/Include/cpython/abstract.h
@@ -156,12 +156,6 @@ PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend(
     PyObject *args,
     PyObject *kwargs);
 
-PyAPI_FUNC(PyObject *) _PyObject_FastCall_Prepend(
-    PyObject *callable,
-    PyObject *obj,
-    PyObject *const *args,
-    Py_ssize_t nargs);
-
 /* Like PyObject_CallMethod(), but expect a _Py_Identifier*
    as the method name. */
 PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *obj,
diff --git a/Objects/call.c b/Objects/call.c
index 8eae1e10d8c5..5bef9f566e8f 100644
--- a/Objects/call.c
+++ b/Objects/call.c
@@ -837,42 +837,6 @@ PyObject_CallObject(PyObject *callable, PyObject *args)
 }
 
 
-/* Positional arguments are obj followed by args:
-   call callable(obj, *args, **kwargs) */
-PyObject *
-_PyObject_FastCall_Prepend(PyObject *callable, PyObject *obj,
-                           PyObject *const *args, Py_ssize_t nargs)
-{
-    PyObject *small_stack[_PY_FASTCALL_SMALL_STACK];
-    PyObject **args2;
-    PyObject *result;
-
-    nargs++;
-    if (nargs <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) {
-        args2 = small_stack;
-    }
-    else {
-        args2 = PyMem_Malloc(nargs * sizeof(PyObject *));
-        if (args2 == NULL) {
-            PyErr_NoMemory();
-            return NULL;
-        }
-    }
-
-    /* use borrowed references */
-    args2[0] = obj;
-    if (nargs > 1) {
-        memcpy(&args2[1], args, (nargs - 1) * sizeof(PyObject *));
-    }
-
-    result = _PyObject_FastCall(callable, args2, nargs);
-    if (args2 != small_stack) {
-        PyMem_Free(args2);
-    }
-    return result;
-}
-
-
 /* Call callable(obj, *args, **kwargs). */
 PyObject *
 _PyObject_Call_Prepend(PyObject *callable,



More information about the Python-checkins mailing list