[PATCH] util: kill Python 2.4 deque.remove hack

Adrian Buehlmann adrian at cadifra.com
Sat May 16 03:51:32 CDT 2015


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1431759801 -7200
# Node ID 3d14c1217117795e3b792369224ed7fa68e31123
# Parent  1ef96a3b8b89a896f2c9f3f977dbef8f45bb0e26
util: kill Python 2.4 deque.remove hack

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -334,17 +334,7 @@
 
     return f
 
-try:
-    collections.deque.remove
-    deque = collections.deque
-except AttributeError:
-    # python 2.4 lacks deque.remove
-    class deque(collections.deque):
-        def remove(self, val):
-            for i, v in enumerate(self):
-                if v == val:
-                    del self[i]
-                    break
+deque = collections.deque
 
 class sortdict(dict):
     '''a simple sorted dictionary'''


More information about the Mercurial-devel mailing list