[Python-checkins] python/nondist/sandbox/itertools itertools.c,1.15,1.16 todo.txt,1.13,1.14
rhettinger@users.sourceforge.net
rhettinger@users.sourceforge.net
Thu, 30 Jan 2003 23:09:26 -0800
Update of /cvsroot/python/python/nondist/sandbox/itertools
In directory sc8-pr-cvs1:/tmp/cvs-serv22307
Modified Files:
itertools.c todo.txt
Log Message:
Result of another code review
Index: itertools.c
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/itertools/itertools.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** itertools.c 31 Jan 2003 06:30:40 -0000 1.15
--- itertools.c 31 Jan 2003 07:09:23 -0000 1.16
***************
*** 74,78 ****
good = PyObject_CallFunctionObjArgs(lz->func, item, NULL);
if (good == NULL) {
- printf("R");
Py_DECREF(item);
return NULL;
--- 74,77 ----
***************
*** 392,396 ****
if (item == NULL)
return NULL;
! lz->cnt += 1;
lz->next += lz->step;
return item;
--- 391,395 ----
if (item == NULL)
return NULL;
! lz->cnt++;
lz->next += lz->step;
return item;
***************
*** 930,935 ****
if (lz->func == Py_None) {
ok = PyObject_IsTrue(item);
! }
! else {
PyObject *good;
good = PyObject_CallFunctionObjArgs(lz->func, item, NULL);
--- 929,933 ----
if (lz->func == Py_None) {
ok = PyObject_IsTrue(item);
! } else {
PyObject *good;
good = PyObject_CallFunctionObjArgs(lz->func, item, NULL);
***************
*** 1188,1196 ****
it = PyTuple_GET_ITEM(lz->ittuple, i);
item = PyIter_Next(it);
! if (item == NULL)
return NULL;
PyTuple_SET_ITEM(result, i, item);
}
- Py_INCREF(result);
return result;
}
--- 1186,1195 ----
it = PyTuple_GET_ITEM(lz->ittuple, i);
item = PyIter_Next(it);
! if (item == NULL) {
! Py_DECREF(result);
return NULL;
+ }
PyTuple_SET_ITEM(result, i, item);
}
return result;
}
***************
*** 1371,1375 ****
Infinite iterators:\n\
count([n]) --> n, n+1, n+2, ...\n\
! repeat(elem) --> elem, elem, elem, elem\n\
\n\
Iterators terminating on the shortest input sequence:\n\
--- 1370,1374 ----
Infinite iterators:\n\
count([n]) --> n, n+1, n+2, ...\n\
! repeat(elem) --> elem, elem, elem, ...\n\
\n\
Iterators terminating on the shortest input sequence:\n\
Index: todo.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/itertools/todo.txt,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** todo.txt 31 Jan 2003 06:30:40 -0000 1.13
--- todo.txt 31 Jan 2003 07:09:24 -0000 1.14
***************
*** 13,16 ****
--- 13,20 ----
tp_traverse looks incomplete
+
+ ? Should times() and count() be subclassable
+ With no accessible methods or members, I would think not.
+
Things dropped because they bug me:
cycle(seqn) requires auxilliary storage (which is surprising