Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue26492

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Exhausted array iterator should left exhausted
Type:behaviorStage:resolved
Components:Extension ModulesVersions:Python 3.6
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To: rhettingerNosy List: benjamin.peterson, larry, python-dev, rhettinger, serhiy.storchaka, vstinner
Priority:normalKeywords:patch

Created on2016-03-06 16:04 byserhiy.storchaka, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
exhausted_array_iterator.patchserhiy.storchaka,2016-03-06 16:04review
exhausted_array_iterator2.patchserhiy.storchaka,2016-03-08 09:38review
Messages (7)
msg261260 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2016-03-06 16:04
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.
msg261329 -(view)Author: Benjamin Peterson (benjamin.peterson)*(Python committer)Date: 2016-03-08 06:37
Can you add just one patch to seq_test.py?
msg261338 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2016-03-08 09:38
Thanks for suggestion Benjamin.seq_tests.py provides common tests for list, tuple, UserList and deque. This test doesn't work for tuple, since it is not mutable. It doesn't work for deque, since it can't be iterated after changing size. Common test for list and UserList can be moved to list_tests.py. In any case we need separate tests for bytearray, array and general sequence iterator.I would be happy to not repeat the test, but tests for array and general sequence iterator have not much common with test for list.Updated patch moves list test to list_tests.py (it now works for UserList) and reuses in for bytearray.
msg261339 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2016-03-08 10:42
I reviewed exhausted_array_iterator2.patch.
msg261342 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2016-03-08 10:57
Thanks Victor. Answered you comments.
msg261344 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2016-03-08 11:01
TODO: After resolvingissue26494 add similar test for array.
msg262676 -(view)Author: Roundup Robot (python-dev)(Python triager)Date: 2016-03-30 18:11
New changeset89ba67ee83d6 by Serhiy Storchaka in branch '3.5':Issue#26492: Added additional tests for exhausted iterators of mutable sequences.https://hg.python.org/cpython/rev/89ba67ee83d6New changesetb4ea00d50e7e by Serhiy Storchaka in branch 'default':Issue#26492: Added additional tests for exhausted iterators of mutable sequences.https://hg.python.org/cpython/rev/b4ea00d50e7eNew changeset249ef9d02aa6 by Serhiy Storchaka in branch '2.7':Issue#26492: Added additional tests for exhausted iterators of mutable sequences.https://hg.python.org/cpython/rev/249ef9d02aa6New changesetb6eebe7cf5ae by Serhiy Storchaka in branch 'default':Issue#26492: Exhausted iterator of array.array now conforms with the behaviorhttps://hg.python.org/cpython/rev/b6eebe7cf5ae
History
DateUserActionArgs
2022-04-11 14:58:28adminsetgithub: 70679
2016-03-31 12:18:36serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2016-03-30 18:11:50python-devsetnosy: +python-dev
messages: +msg262676
2016-03-08 11:01:56serhiy.storchakasetmessages: +msg261344
2016-03-08 10:57:36serhiy.storchakasetmessages: +msg261342
2016-03-08 10:42:37vstinnersetnosy: +vstinner
messages: +msg261339
2016-03-08 09:38:41serhiy.storchakasetfiles: +exhausted_array_iterator2.patch

messages: +msg261338
2016-03-08 06:37:01benjamin.petersonsetmessages: +msg261329
2016-03-06 16:04:40serhiy.storchakacreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp