[New-bugs-announce] [issue26492] Exhausted array iterator should left exhausted

Serhiy Storchaka report at bugs.python.org
Sun Mar 6 11:04:40 EST 2016

New submission from Serhiy Storchaka:

There is general rule that after raising StopIteration the iterator should always raise StopIteration even if new data is added to iterating sequence. Array iterators don't obey this rule.

Proposed patch makes array iterator to left in exhausted state since it achieved. As a side (or may be primary) effect of this change, iterating sequence can be freed just after iterating is finished.

Added tests for other iterators of resizable sequences.

I don't know whether this patch should be applied to maintained releases or only to default branch. Note that array pickling tests broken by this patch were just added. They just expose current (presumably incorrect) behavior.

assignee: rhettinger
components: Extension Modules
files: exhausted_array_iterator.patch
keywords: patch
messages: 261260
nosy: benjamin.peterson, larry, rhettinger, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Exhausted array iterator should left exhausted
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file42079/exhausted_array_iterator.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list