
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2016-03-06 16:04 byserhiy.storchaka, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| exhausted_array_iterator.patch | serhiy.storchaka,2016-03-06 16:04 | review | ||
| exhausted_array_iterator2.patch | serhiy.storchaka,2016-03-08 09:38 | review | ||
| Messages (7) | |||
|---|---|---|---|
| msg261260 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | 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)*![]() | Date: 2016-03-08 06:37 | |
Can you add just one patch to seq_test.py? | |||
| msg261338 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | 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)*![]() | Date: 2016-03-08 10:42 | |
I reviewed exhausted_array_iterator2.patch. | |||
| msg261342 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2016-03-08 10:57 | |
Thanks Victor. Answered you comments. | |||
| msg261344 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2016-03-08 11:01 | |
TODO: After resolvingissue26494 add similar test for array. | |||
| msg262676 -(view) | Author: Roundup Robot (python-dev)![]() | 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 | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:28 | admin | set | github: 70679 |
| 2016-03-31 12:18:36 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2016-03-30 18:11:50 | python-dev | set | nosy: +python-dev messages: +msg262676 |
| 2016-03-08 11:01:56 | serhiy.storchaka | set | messages: +msg261344 |
| 2016-03-08 10:57:36 | serhiy.storchaka | set | messages: +msg261342 |
| 2016-03-08 10:42:37 | vstinner | set | nosy: +vstinner messages: +msg261339 |
| 2016-03-08 09:38:41 | serhiy.storchaka | set | files: +exhausted_array_iterator2.patch messages: +msg261338 |
| 2016-03-08 06:37:01 | benjamin.peterson | set | messages: +msg261329 |
| 2016-03-06 16:04:40 | serhiy.storchaka | create | |