[issue24369] Using OrderedDict.move_to_end during iteration is problematic.

2015-06-03 Thread Eric Snow
Eric Snow added the comment: Here's a patch that tracks changes to the C OrderedDict linked list, similar to how it's done in deque. I've left the pure Python OrderedDict alone. @Raymond, that state counter works great. :) -- keywords: +patch stage: test needed - patch review Added

[issue24369] Using OrderedDict.move_to_end during iteration is problematic.

2015-06-02 Thread Eric Snow
New submission from Eric Snow: 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

[issue24369] Using OrderedDict.move_to_end during iteration is problematic.

2015-06-02 Thread Raymond Hettinger
Raymond Hettinger added the comment: 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

[issue24369] Using OrderedDict.move_to_end during iteration is problematic.

2015-06-02 Thread Eric Snow
Eric Snow added the comment: Sounds good. Thanks, Raymond. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24369 ___ ___ Python-bugs-list