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.

Author eric.snow
Recipients eric.snow, rhettinger
Date 2015-06-03.00:12:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1433290338.7.0.000891245826788.issue24369@psf.upfronthosting.co.za>
In-reply-to
Content
While the dict/OrderedDict iterators already check for additions and deletions, using the OrderedDict.move_to_end during iteration can lead to surprising results.

The following results in an infinite loop:

    od = OrderedDict.fromkeys('abc')
    last = None
    for k in od:
        if last is not None:
            od.move_to_end(last)
        last = k

Ideally we could disallow changing order during iteration, just like we disallow deletion.  Since we've gone 3 minor versions already, would it be too late to break backward compatibility on this point?
History
Date User Action Args
2015-06-03 00:12:18eric.snowsetrecipients: + eric.snow, rhettinger
2015-06-03 00:12:18eric.snowsetmessageid: <1433290338.7.0.000891245826788.issue24369@psf.upfronthosting.co.za>
2015-06-03 00:12:18eric.snowlinkissue24369 messages
2015-06-03 00:12:18eric.snowcreate