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
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
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
Eric Snow added the comment:
Sounds good. Thanks, Raymond.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24369
___
___
Python-bugs-list