Commit 69112676 authored by Victor Stinner's avatar Victor Stinner

slot_tp_iter() now uses fast call

Issue #27128: slot_tp_iter() now calls _PyObject_FastCall() to avoid a
temporary empty tuple.
parent 20a3007a
......@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment