From: Victor Stinner Date: Fri, 19 Aug 2016 14:42:42 +0000 (+0200) Subject: PyEval_CallObjectWithKeywords() uses fast call X-Git-Tag: v3.6.0b1~663 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3f745bf1d90a75a0e3df5ba4d59b3ffbb71e3ebc;p=python PyEval_CallObjectWithKeywords() uses fast call Issue #27128: Modify PyEval_CallObjectWithKeywords() to use _PyObject_FastCall() when args==NULL and kw==NULL. It avoids the creation of a temporary empty tuple for positional arguments. --- diff --git a/Python/ceval.c b/Python/ceval.c index b9b21d14be..75eaa8110a 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4592,6 +4592,10 @@ PyEval_CallObjectWithKeywords(PyObject *func, PyObject *arg, PyObject *kw) #endif if (arg == NULL) { + if (kw == NULL) { + return _PyObject_FastCall(func, NULL, 0, 0); + } + arg = PyTuple_New(0); if (arg == NULL) return NULL;