mirror of https://github.com/python/cpython
slot_tp_iter() now uses fast call
Issue #27128: slot_tp_iter() now calls _PyObject_FastCall() to avoid a temporary empty tuple.
This commit is contained in:
parent
20a3007a8d
commit
6911267615
|
@ -6264,16 +6264,13 @@ slot_tp_iter(PyObject *self)
|
||||||
Py_TYPE(self)->tp_name);
|
Py_TYPE(self)->tp_name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (func != NULL) {
|
if (func != NULL) {
|
||||||
PyObject *args;
|
res = _PyObject_FastCall(func, NULL, 0, NULL);
|
||||||
args = res = PyTuple_New(0);
|
|
||||||
if (args != NULL) {
|
|
||||||
res = PyObject_Call(func, args, NULL);
|
|
||||||
Py_DECREF(args);
|
|
||||||
}
|
|
||||||
Py_DECREF(func);
|
Py_DECREF(func);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
func = lookup_method(self, &PyId___getitem__);
|
func = lookup_method(self, &PyId___getitem__);
|
||||||
if (func == NULL) {
|
if (func == NULL) {
|
||||||
|
|
Loading…
Reference in New Issue