Author: Alex Gaynor <[email protected]>
Branch: kill-single-impl-multimethods
Changeset: r46360:e312c5bf1bc9
Date: 2011-08-07 17:40 -0700
http://bitbucket.org/pypy/pypy/changeset/e312c5bf1bc9/

Log:    fix for dict !=.

diff --git a/pypy/objspace/std/dicttype.py b/pypy/objspace/std/dicttype.py
--- a/pypy/objspace/std/dicttype.py
+++ b/pypy/objspace/std/dicttype.py
@@ -146,6 +146,9 @@
         return space.w_True
 
     def descr__ne__(self, space, w_other):
+        if not isinstance(w_other, W_DictMultiObject):
+            return space.w_NotImplemented
+
         return space.not_(self.descr__eq__(space, w_other))
 
     def descr_items(self, space):
diff --git a/pypy/objspace/std/test/test_dictmultiobject.py 
b/pypy/objspace/std/test/test_dictmultiobject.py
--- a/pypy/objspace/std/test/test_dictmultiobject.py
+++ b/pypy/objspace/std/test/test_dictmultiobject.py
@@ -349,6 +349,12 @@
         bool = d1 != d3
         assert bool == True
 
+    def test_ne(self):
+        class x(dict):
+            def __eq__(self, other):
+                return False
+        assert x() != set(["a"])
+
     def test_lt(self):
         d1 = {1: 2, 3: 4}
         d2 = {1: 2, 3: 4}
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to