summaryrefslogtreecommitdiffstats
path: root/Lib/collections/__init__.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2014-05-04 04:58:45 (GMT)
committerRaymond Hettinger <python@rcn.com>2014-05-04 04:58:45 (GMT)
commit53d2c41f77ab7658a1380bc304946b4920e5b49b (patch)
tree8bd81a22a224983b3376357c8afa0c6988244665 /Lib/collections/__init__.py
parent71ac07f8baf21bf7a116e97accc12804f1afcdd4 (diff)
downloadcpython-53d2c41f77ab7658a1380bc304946b4920e5b49b.zip
cpython-53d2c41f77ab7658a1380bc304946b4920e5b49b.tar.gz
cpython-53d2c41f77ab7658a1380bc304946b4920e5b49b.tar.bz2
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.
Diffstat (limited to 'Lib/collections/__init__.py')
-rw-r--r--Lib/collections/__init__.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
index 3605cc3..a55fee1 100644
--- a/Lib/collections/__init__.py
+++ b/Lib/collections/__init__.py
@@ -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)'