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 <rep...@bugs.python.org> <http://bugs.python.org/issue26492> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com