Author: Manuel Jacob
Branch: 
Changeset: r64466:5bcf229de77c
Date: 2013-05-22 18:38 +0200
http://bitbucket.org/pypy/pypy/changeset/5bcf229de77c/

Log:    Test and fix for ``((1, 2) == object())`` returning
        space.w_NotImplementedError.

diff --git a/pypy/objspace/std/specialisedtupleobject.py 
b/pypy/objspace/std/specialisedtupleobject.py
--- a/pypy/objspace/std/specialisedtupleobject.py
+++ b/pypy/objspace/std/specialisedtupleobject.py
@@ -74,7 +74,7 @@
 
         def descr_eq(self, space, w_other):
             if not isinstance(w_other, W_AbstractTupleObject):
-                return space.w_NotImplementedError
+                return space.w_NotImplemented
             if not isinstance(w_other, cls):
                 if nValues != w_other.length():
                     return space.w_False
diff --git a/pypy/objspace/std/test/test_tupleobject.py 
b/pypy/objspace/std/test/test_tupleobject.py
--- a/pypy/objspace/std/test/test_tupleobject.py
+++ b/pypy/objspace/std/test/test_tupleobject.py
@@ -399,3 +399,11 @@
         assert ((5,) != (N,)) is True
         assert ((5,) >  (N,)) is False
         assert ((5,) >= (N,)) is False
+
+    def test_eq_other_type(self):
+        assert (() == object()) is False
+        assert ((1,) == object()) is False
+        assert ((1, 2) == object()) is False
+        assert (() != object()) is True
+        assert ((1,) != object()) is True
+        assert ((1, 2) != object()) is True
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to