This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: unexpected iterator behavior with removal
Type: behavior Stage:
Components: Interpreter Core Versions: Python 2.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: JosephArmbruster, christian.heimes
Priority: normal Keywords:

Created on 2007-11-18 04:32 by JosephArmbruster, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
listobjectpatch.patch JosephArmbruster, 2007-11-18 04:32
Messages (2)
msg57611 - (view) Author: Joseph Armbruster (JosephArmbruster) Date: 2007-11-18 04:32
Trunk Revision: 58651

Example of potential issue:

>>> a = [1,2,3,4,5]
>>>
>>> for x in a:
...   a.remove(x)
...
>>>
>>> a
[2, 4]


If this is the expected behavior of iteration in this case, my
apologies.  If this is not, I believe the issue lies in that
listiter_next does not act correctly after a listremove has occurred.

My knowledge of Python development is practically 0, so please take the
patch with a grain of salt.
msg57612 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-11-18 04:37
Closed as discussed on IRC.
History
Date User Action Args
2022-04-11 14:56:28adminsetgithub: 45797
2007-11-18 04:37:20christian.heimessetstatus: open -> closed
resolution: not a bug
messages: + msg57612
nosy: + christian.heimes
2007-11-18 04:32:13JosephArmbrustercreate