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 rhettinger
Recipients eric.snow, rhettinger
Date 2015-06-03.01:58:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1433296700.37.0.687069583429.issue24369@psf.upfronthosting.co.za>
In-reply-to
Content
The C version should defend itself against any key-changes during iteration (see the state counter used in deque objects for an example of how to do this).   The pure python version of OrderedDict has only minimal defenses against mutating during iteration, and it should be left as-is.

FWIW, "surprising" is in the eye of the beholder.  When it comes to mutating containers during iteration, all kinds of things can happen (that is why databases implement reader and writer locks).  

The following results in an infinite loop:

    s = list('abc')
    for k in s:
        s.append(k)
History
Date User Action Args
2015-06-03 01:58:20rhettingersetrecipients: + rhettinger, eric.snow
2015-06-03 01:58:20rhettingersetmessageid: <1433296700.37.0.687069583429.issue24369@psf.upfronthosting.co.za>
2015-06-03 01:58:20rhettingerlinkissue24369 messages
2015-06-03 01:58:19rhettingercreate