]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
slot_tp_iter() now uses fast call
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 19 Aug 2016 16:41:02 +0000 (18:41 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 19 Aug 2016 16:41:02 +0000 (18:41 +0200)
Issue #27128: slot_tp_iter() now calls _PyObject_FastCall() to avoid a
temporary empty tuple.

Objects/typeobject.c

index 4d259275b4e5a6cc6a32c5cf504cb904bcdb8dc5..68e4f90ab6bcfb7ddd0d3e5ad38ea9681b18a8b3 100644 (file)
@@ -6264,16 +6264,13 @@ slot_tp_iter(PyObject *self)
                      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) {