changeset 22643:3b1c0e1ede4c

util: fix sorteddict.pop When using `.pop` on such object the list was not cleared of the popped key, leading to crash.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 02 Oct 2014 12:39:37 -0500
parents 45e50d8546d9
children 1ec7cdaf898f
files mercurial/util.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Fri Sep 26 12:51:55 2014 -0700
+++ b/mercurial/util.py	Thu Oct 02 12:39:37 2014 -0500
@@ -252,6 +252,12 @@
     def __delitem__(self, key):
         dict.__delitem__(self, key)
         self._list.remove(key)
+    def pop(self, key, *args, **kwargs):
+        dict.pop(self, key, *args, **kwargs)
+        try:
+            self._list.remove(key)
+        except ValueError:
+            pass
     def keys(self):
         return self._list
     def iterkeys(self):