[New-bugs-announce] [issue1456] unexpected iterator behavior with removal

Joseph Armbruster report at bugs.python.org
Sun Nov 18 05:32:14 CET 2007


New submission from Joseph Armbruster:

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.

----------
components: Interpreter Core
files: listobjectpatch.patch
messages: 57611
nosy: JosephArmbruster
severity: normal
status: open
title: unexpected iterator behavior with removal
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file8769/listobjectpatch.patch

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1456>
__________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: listobjectpatch.patch
Type: application/octet-stream
Size: 1638 bytes
Desc: not available
Url : http://mail.python.org/pipermail/new-bugs-announce/attachments/20071118/ce4d3c6b/attachment.obj 


More information about the New-bugs-announce mailing list