mirror of
https://github.com/python/cpython.git
synced 2024-12-12 19:33:52 +08:00
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);
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user