summaryrefslogtreecommitdiffstats
path: root/Modules/collectionsmodule.c
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-04-12 18:10:01 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-04-12 18:10:01 (GMT)
commit7892b1c651d72a5bd08372f40309dec08a7065f0 (patch)
tree7ae71a1e81651c4fa7f786ebfbdbc8364a41730e /Modules/collectionsmodule.c
parent45d0b5cc44ffb6227a2379a39b00d480f253edd5 (diff)
downloadcpython-7892b1c651d72a5bd08372f40309dec08a7065f0.zip
cpython-7892b1c651d72a5bd08372f40309dec08a7065f0.tar.gz
cpython-7892b1c651d72a5bd08372f40309dec08a7065f0.tar.bz2
* Add unittests for iterators that report their length
* Document the differences between them * Fix corner cases covered by the unittests * Use Py_RETURN_NONE where possible for dictionaries
Diffstat (limited to 'Modules/collectionsmodule.c')
-rw-r--r--Modules/collectionsmodule.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/collectionsmodule.c b/Modules/collectionsmodule.c
index cf474f7..fc30c99 100644
--- a/Modules/collectionsmodule.c
+++ b/Modules/collectionsmodule.c
@@ -770,6 +770,7 @@ dequeiter_next(dequeiterobject *it)
if (it->len != it->deque->len) {
it->len = -1; /* Make this state sticky */
+ it->counter = 0;
PyErr_SetString(PyExc_RuntimeError,
"deque changed size during iteration");
return NULL;
@@ -860,6 +861,7 @@ dequereviter_next(dequeiterobject *it)
if (it->len != it->deque->len) {
it->len = -1; /* Make this state sticky */
+ it->counter = 0;
PyErr_SetString(PyExc_RuntimeError,
"deque changed size during iteration");
return NULL;