(original) (raw)
changeset: 102778:45d2b5c12b19 user: Victor Stinner victor.stinner@gmail.com date: Fri Aug 19 18:41:02 2016 +0200 files: Objects/typeobject.c description: slot_tp_iter() now uses fast call Issue #27128: slot_tp_iter() now calls _PyObject_FastCall() to avoid a temporary empty tuple. diff -r 6a21b6599692 -r 45d2b5c12b19 Objects/typeobject.c --- a/Objects/typeobject.c Fri Aug 19 18:28:25 2016 +0200 +++ b/Objects/typeobject.c Fri Aug 19 18:41:02 2016 +0200 @@ -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) { /victor.stinner@gmail.com