diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-08-19 18:41:02 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-08-19 18:41:02 +0200 |
commit | 6911267615ab805d555ef2b0a2458feebbc80d6d (patch) | |
tree | 986ce211419c00d9f1bc0c64c515a018e2d72ec3 | |
parent | 20a3007a8de57c99713cae8849634f47689a8f19 (diff) | |
download | cpython-git-6911267615ab805d555ef2b0a2458feebbc80d6d.tar.gz |
slot_tp_iter() now uses fast call
Issue #27128: slot_tp_iter() now calls _PyObject_FastCall() to avoid a
temporary empty tuple.
-rw-r--r-- | Objects/typeobject.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 4d259275b4..68e4f90ab6 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -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) { |