summaryrefslogtreecommitdiffstats
path: root/Objects/abstract.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-08-19 14:44:19 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-08-19 14:44:19 (GMT)
commit8880708f8149856b99abf480f913760a64203c39 (patch)
tree003c1165bd7811b2a3fc706267540a42365d4799 /Objects/abstract.c
parent3f745bf1d90a75a0e3df5ba4d59b3ffbb71e3ebc (diff)
downloadcpython-8880708f8149856b99abf480f913760a64203c39.zip
cpython-8880708f8149856b99abf480f913760a64203c39.tar.gz
cpython-8880708f8149856b99abf480f913760a64203c39.tar.bz2
call_function_tail() uses fast call
Issue #27128: Modify call_function_tail() to use _PyObject_FastCall() when args is not a tuple to avoid the creation of a temporary tuple. call_function_tail() is used by: * PyObject_CallFunction() * PyObject_CallMethod() * _PyObject_CallMethodId()
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r--Objects/abstract.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 36401a8..1a63c6b 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -2272,27 +2272,20 @@ exit:
static PyObject*
call_function_tail(PyObject *callable, PyObject *args)
{
- PyObject *retval;
+ PyObject *result;
if (args == NULL)
return NULL;
if (!PyTuple_Check(args)) {
- PyObject *a;
-
- a = PyTuple_New(1);
- if (a == NULL) {
- Py_DECREF(args);
- return NULL;
- }
- PyTuple_SET_ITEM(a, 0, args);
- args = a;
+ result = _PyObject_FastCall(callable, &args, 1, NULL);
+ }
+ else {
+ result = PyObject_Call(callable, args, NULL);
}
- retval = PyObject_Call(callable, args, NULL);
Py_DECREF(args);
-
- return retval;
+ return result;
}
PyObject *