From 3f745bf1d90a75a0e3df5ba4d59b3ffbb71e3ebc Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 19 Aug 2016 16:42:42 +0200 Subject: [PATCH] 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. --- Python/ceval.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Python/ceval.c b/Python/ceval.c index b9b21d14be4..75eaa8110a2 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;