mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
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:
parent
71ac07f8ba
commit
53d2c41f77
3 changed files with 15 additions and 0 deletions
|
@ -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)'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue