summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index a06ef61..31d9e0e 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -331,7 +331,7 @@ builtin_any(PyModuleDef *module, PyObject *iterable)
Py_DECREF(it);
return NULL;
}
- if (cmp == 1) {
+ if (cmp > 0) {
Py_DECREF(it);
Py_RETURN_TRUE;
}
@@ -469,6 +469,7 @@ filter_next(filterobject *lz)
PyObject *it = lz->it;
long ok;
PyObject *(*iternext)(PyObject *);
+ int checktrue = lz->func == Py_None || lz->func == (PyObject *)&PyBool_Type;
iternext = *Py_TYPE(it)->tp_iternext;
for (;;) {
@@ -476,12 +477,11 @@ filter_next(filterobject *lz)
if (item == NULL)
return NULL;
- if (lz->func == Py_None || lz->func == (PyObject *)&PyBool_Type) {
+ if (checktrue) {
ok = PyObject_IsTrue(item);
} else {
PyObject *good;
- good = PyObject_CallFunctionObjArgs(lz->func,
- item, NULL);
+ good = PyObject_CallFunctionObjArgs(lz->func, item, NULL);
if (good == NULL) {
Py_DECREF(item);
return NULL;
@@ -1174,13 +1174,14 @@ map_next(mapobject *lz)
PyObject *result;
Py_ssize_t numargs, i;
- numargs = PyTuple_Size(lz->iters);
+ numargs = PyTuple_GET_SIZE(lz->iters);
argtuple = PyTuple_New(numargs);
if (argtuple == NULL)
return NULL;
for (i=0 ; i<numargs ; i++) {
- val = PyIter_Next(PyTuple_GET_ITEM(lz->iters, i));
+ PyObject *it = PyTuple_GET_ITEM(lz->iters, i);
+ val = Py_TYPE(it)->tp_iternext(it);
if (val == NULL) {
Py_DECREF(argtuple);
return NULL;