summaryrefslogtreecommitdiff
path: root/Objects/iterobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-08-16 17:01:09 +0000
committerGuido van Rossum <guido@python.org>2002-08-16 17:01:09 +0000
commit84b2bed4359e27070fe2eac4b464d4a1bc6e150d (patch)
tree0d1e50962419f5bf7e69bbc899b29a8d762e5d08 /Objects/iterobject.c
parentc13f724af0a09d515efae57b902a1270b6aba4ac (diff)
downloadcpython-git-84b2bed4359e27070fe2eac4b464d4a1bc6e150d.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.c7
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,