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

victor.stinner python-checkins at python.org
Fri Aug 19 12:53:54 EDT 2016


https://hg.python.org/cpython/rev/45d2b5c12b19
changeset:   102778:45d2b5c12b19
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Fri Aug 19 18:41:02 2016 +0200
summary:
  slot_tp_iter() now uses fast call

Issue #27128: slot_tp_iter() now calls _PyObject_FastCall() to avoid a
temporary empty tuple.

files:
  Objects/typeobject.c |  9 +++------
  1 files changed, 3 insertions(+), 6 deletions(-)


diff --git a/Objects/typeobject.c b/Objects/typeobject.c
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -6264,16 +6264,13 @@
                      Py_TYPE(self)->tp_name);
         return NULL;
     }
+
     if (func != NULL) {
-        PyObject *args;
-        args = res = PyTuple_New(0);
-        if (args != NULL) {
-            res = PyObject_Call(func, args, NULL);
-            Py_DECREF(args);
-        }
+        res = _PyObject_FastCall(func, NULL, 0, NULL);
         Py_DECREF(func);
         return res;
     }
+
     PyErr_Clear();
     func = lookup_method(self, &PyId___getitem__);
     if (func == NULL) {

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


More information about the Python-checkins mailing list