]> granicus.if.org Git - python/commitdiff
PyEval_CallObjectWithKeywords() uses fast call
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 19 Aug 2016 14:42:42 +0000 (16:42 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 19 Aug 2016 14:42:42 +0000 (16:42 +0200)
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

index b9b21d14be426de1d9eb5a185f0caceba04351ae..75eaa8110a28f16fb0be96e0a4e901c2080eb9a9 100644 (file)
@@ -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;