Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3k
Changeset: r57786:31bd302f43ac
Date: 2012-10-04 22:06 +0200
http://bitbucket.org/pypy/pypy/changeset/31bd302f43ac/

Log:    The default implementation of __ne__ should now call not(x==y).

        This explains why running CPython test suite always displayed
        "Warning -- threading._dangling was modified".

diff --git a/pypy/objspace/descroperation.py b/pypy/objspace/descroperation.py
--- a/pypy/objspace/descroperation.py
+++ b/pypy/objspace/descroperation.py
@@ -572,11 +572,14 @@
         #
         # we did not find any special method, let's do the default logic for
         # == and !=
-        if left == '__eq__' or left == '__ne__':
+        if left == '__eq__':
             # they are not identical, else it would have been caught by the if
             # at the top of the function
             assert not space.is_w(w_obj1, w_obj2)
-            return space.wrap(left != '__eq__')
+            return space.w_False
+        elif left == '__ne__':
+            assert not space.is_w(w_obj1, w_obj2)
+            return space.not_(space.eq(w_obj1, w_obj2))
         #
         # if we arrived here, they are unorderable
         typename1 = space.type(w_obj1).getname(space)
diff --git a/pypy/objspace/test/test_descroperation.py 
b/pypy/objspace/test/test_descroperation.py
--- a/pypy/objspace/test/test_descroperation.py
+++ b/pypy/objspace/test/test_descroperation.py
@@ -440,6 +440,10 @@
         assert B(1) == A(1)
         assert not(A(1) == B(2))
         assert not(B(1) == A(2))
+        assert A(1) != B(2)
+        assert B(1) != A(2)
+        assert not(A(1) != B(1))
+        assert not(B(1) != A(1))
 
     def test_partial_ordering(self):
         class A(object):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to