mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Squash a few calls to the hideously expensive PyObject_CallObject(o,a)
-- replace then with slightly faster PyObject_Call(o,a,NULL). (The difference is that the latter requires a to be a tuple; the former allows other values and wraps them in a tuple if necessary; it involves two more levels of C function calls to accomplish all that.)
This commit is contained in:
parent
c13f724af0
commit
84b2bed435
5 changed files with 37 additions and 12 deletions
|
@ -163,7 +163,12 @@ static PyObject *
|
|||
calliter_iternext(calliterobject *it)
|
||||
{
|
||||
if (it->it_callable != NULL) {
|
||||
PyObject *result = PyObject_CallObject(it->it_callable, NULL);
|
||||
PyObject *args = PyTuple_New(0);
|
||||
PyObject *result;
|
||||
if (args == NULL)
|
||||
return NULL;
|
||||
result = PyObject_Call(it->it_callable, args, NULL);
|
||||
Py_DECREF(args);
|
||||
if (result != NULL) {
|
||||
int ok;
|
||||
ok = PyObject_RichCompareBool(result,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue