[PATCH] sortdict: fix .pop() to return a value

Yuya Nishihara yuya at tcha.org
Sun Apr 9 13:10:01 UTC 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1491706629 -32400
#      Sun Apr 09 11:57:09 2017 +0900
# Node ID 48a7a1f77a9489e3c4b5f862243782ceae80eaf9
# Parent  9259cf823690e4fcd34a4d2ecd57ced2060d2b3d
sortdict: fix .pop() to return a value

My future patch will need it.

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -555,11 +555,11 @@ class sortdict(dict):
         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
+        return dict.pop(self, key, *args, **kwargs)
     def keys(self):
         return self._list[:]
     def iterkeys(self):


More information about the Mercurial-devel mailing list