Issue #19414: Have the OrderedDict mark deleted links as unusable.

This gives an earlier and more visible failure if a link is deleted
during iteration.
This commit is contained in:
Raymond Hettinger 2014-05-03 21:58:45 -07:00
parent 71ac07f8ba
commit 53d2c41f77
3 changed files with 15 additions and 0 deletions

View file

@ -96,6 +96,8 @@ class OrderedDict(dict):
link_next = link.next
link_prev.next = link_next
link_next.prev = link_prev
link.prev = None
link.next = None
def __iter__(self):
'od.__iter__() <==> iter(od)'