diff options
author | Guido van Rossum <guido@python.org> | 2002-08-16 17:01:09 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-08-16 17:01:09 +0000 |
commit | 39db7ab3dfa619a920c713621d8cface89610aa6 (patch) | |
tree | ce2c794f1b87433ebb07fa1c93c4453bdc69d685 /Objects/iterobject.c | |
parent | 243bd7b8c4812843f88b13cf5bc8f7d1df3f873c (diff) | |
download | cpython-39db7ab3dfa619a920c713621d8cface89610aa6.tar.gz |
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.)
Diffstat (limited to 'Objects/iterobject.c')
-rw-r--r-- | Objects/iterobject.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Objects/iterobject.c b/Objects/iterobject.c index 4dc225a521..2e1caae543 100644 --- a/Objects/iterobject.c +++ b/Objects/iterobject.c @@ -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, |