diff options
author | Raymond Hettinger <python@rcn.com> | 2007-01-08 18:05:53 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2007-01-08 18:05:53 (GMT) |
commit | 5b44cbe6d8f9c07f6ec0da1134dc3b49ee81a4e3 (patch) | |
tree | 4efa4e2a2a22f3dd84ff1ea07411d7363ac15fe0 /Modules | |
parent | f96725af8bf2a394b85104be13583ff091c6a634 (diff) | |
download | cpython-5b44cbe6d8f9c07f6ec0da1134dc3b49ee81a4e3.zip cpython-5b44cbe6d8f9c07f6ec0da1134dc3b49ee81a4e3.tar.gz cpython-5b44cbe6d8f9c07f6ec0da1134dc3b49ee81a4e3.tar.bz2 |
Fix zero-length corner case for iterating over a mutating deque.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/collectionsmodule.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Modules/collectionsmodule.c b/Modules/collectionsmodule.c index c1bd732..a0570cd 100644 --- a/Modules/collectionsmodule.c +++ b/Modules/collectionsmodule.c @@ -911,15 +911,14 @@ dequeiter_next(dequeiterobject *it) { PyObject *item; - if (it->counter == 0) - return NULL; - if (it->deque->state != it->state) { it->counter = 0; PyErr_SetString(PyExc_RuntimeError, "deque mutated during iteration"); return NULL; } + if (it->counter == 0) + return NULL; assert (!(it->b == it->deque->rightblock && it->index > it->deque->rightindex)); |