[Python-checkins] cpython: PyEval_CallObjectWithKeywords() uses fast call

victor.stinner python-checkins at python.org
Fri Aug 19 11:32:17 EDT 2016


https://hg.python.org/cpython/rev/89e4ad001f3d
changeset:   102757:89e4ad001f3d
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Fri Aug 19 16:42:42 2016 +0200
summary:
  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.

files:
  Python/ceval.c |  4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Python/ceval.c b/Python/ceval.c
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4592,6 +4592,10 @@
 #endif
 
     if (arg == NULL) {
+        if (kw == NULL) {
+            return _PyObject_FastCall(func, NULL, 0, 0);
+        }
+
         arg = PyTuple_New(0);
         if (arg == NULL)
             return NULL;

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list