Author: Brian Kearns <[email protected]>
Branch:
Changeset: r60997:a8d47219e78c
Date: 2013-02-08 21:18 -0500
http://bitbucket.org/pypy/pypy/changeset/a8d47219e78c/
Log: backout accidental inclusion to last commit
diff --git a/lib_pypy/_collections.py b/lib_pypy/_collections.py
--- a/lib_pypy/_collections.py
+++ b/lib_pypy/_collections.py
@@ -142,15 +142,12 @@
return c
def remove(self, value):
+ # Need to be defensive for mutating comparisons
for i in range(len(self)):
- elem = self.popleft()
- if elem == value:
- break
- self.append(elem)
- else:
- raise ValueError("deque.remove(x): x not in deque")
- for i in range(len(self) - i):
- self.append(self.popleft())
+ if self[i] == value:
+ del self[i]
+ return
+ raise ValueError("deque.remove(x): x not in deque")
def rotate(self, n=1):
length = len(self)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit