summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-08-22 21:21:55 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-08-22 21:21:55 (GMT)
commit2990fa11bc6f8a78b90a2a742756a6fd45c4833d (patch)
treec65c584609f8e5c8e1a27648382877927b55baf5 /Python
parent6fea7f7ffc5ca840e4d54b5777669129b8ee6276 (diff)
downloadcpython-2990fa11bc6f8a78b90a2a742756a6fd45c4833d.zip
cpython-2990fa11bc6f8a78b90a2a742756a6fd45c4833d.tar.gz
cpython-2990fa11bc6f8a78b90a2a742756a6fd45c4833d.tar.bz2
Issue #27809: Use _PyObject_FastCallDict()
Modify: * builtin_sorted() * classmethoddescr_call() * methoddescr_call() * wrapperdescr_call()
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 220c92d..1cdc0e2 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -2087,10 +2087,11 @@ PyDoc_STRVAR(builtin_sorted__doc__,
static PyObject *
builtin_sorted(PyObject *self, PyObject *args, PyObject *kwds)
{
- PyObject *newlist, *v, *seq, *keyfunc=NULL, *newargs;
+ PyObject *newlist, *v, *seq, *keyfunc=NULL, **newargs;
PyObject *callable;
static char *kwlist[] = {"iterable", "key", "reverse", 0};
int reverse;
+ int nargs;
/* args 1-3 should match listsort in Objects/listobject.c */
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|Oi:sorted",
@@ -2107,15 +2108,9 @@ builtin_sorted(PyObject *self, PyObject *args, PyObject *kwds)
return NULL;
}
- newargs = PyTuple_GetSlice(args, 1, 4);
- if (newargs == NULL) {
- Py_DECREF(newlist);
- Py_DECREF(callable);
- return NULL;
- }
-
- v = PyObject_Call(callable, newargs, kwds);
- Py_DECREF(newargs);
+ newargs = &PyTuple_GET_ITEM(args, 1);
+ nargs = PyTuple_GET_SIZE(args) - 1;
+ v = _PyObject_FastCallDict(callable, newargs, nargs, kwds);
Py_DECREF(callable);
if (v == NULL) {
Py_DECREF(newlist);