diff options
author | 2016-12-31 12:01:59 -0700 | |
---|---|---|
committer | 2016-12-31 12:01:59 -0700 | |
commit | b46ea9034349b9d713daff581e624afe07916629 (patch) | |
tree | 57d100415241ca7a3fcc7b76333471e613028844 /Lib/collections | |
parent | Issue #26267: Improve uuid.UUID documentation (diff) | |
download | cpython-b46ea9034349b9d713daff581e624afe07916629.tar.gz cpython-b46ea9034349b9d713daff581e624afe07916629.tar.bz2 cpython-b46ea9034349b9d713daff581e624afe07916629.zip |
Issue #29119: Fix weakref in OrderedDict.move_to_end(). Work by Andra Bogildea.
Diffstat (limited to 'Lib/collections')
-rw-r--r-- | Lib/collections/__init__.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py index ebe8ee7a838..bea811db7fa 100644 --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -189,6 +189,7 @@ class OrderedDict(dict): link = self.__map[key] link_prev = link.prev link_next = link.next + soft_link = link_next.prev link_prev.next = link_next link_next.prev = link_prev root = self.__root @@ -196,12 +197,14 @@ class OrderedDict(dict): last = root.prev link.prev = last link.next = root - last.next = root.prev = link + root.prev = soft_link + last.next = link else: first = root.next link.prev = root link.next = first - root.next = first.prev = link + first.prev = soft_link + root.next = link def __sizeof__(self): sizeof = _sys.getsizeof |