Author: Antonio Cuni <[email protected]>
Branch: py3k
Changeset: r53028:182e7d13839c
Date: 2012-02-29 14:34 +0100
http://bitbucket.org/pypy/pypy/changeset/182e7d13839c/

Log:    make sure that we cannot compare with None either

diff --git a/pypy/objspace/descroperation.py b/pypy/objspace/descroperation.py
--- a/pypy/objspace/descroperation.py
+++ b/pypy/objspace/descroperation.py
@@ -526,10 +526,6 @@
     # fall back to internal rules
     if space.is_w(w_obj1, w_obj2):
         return space.wrap(0)
-    if space.is_w(w_obj1, space.w_None):
-        return space.wrap(-1)
-    if space.is_w(w_obj2, space.w_None):
-        return space.wrap(1)
     else:
         typename1 = space.type(w_obj1).getname(space)
         typename2 = space.type(w_obj2).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
@@ -301,13 +301,13 @@
         raises(AttributeError, getattr, x, 'a')
 
     def test_unordeable_types(self):
-        # incomparable objects sort by type name :-/
         class A(object): pass
         class zz(object): pass
         raises(TypeError, "A() < zz()")
         raises(TypeError, "zz() > A()")
         raises(TypeError, "A() < A()")
-        # if in doubt, CPython sorts numbers before non-numbers
+        raises(TypeError, "A() < None")
+        raises(TypeError, "None < A()")
         raises(TypeError, "0 < ()")
         raises(TypeError, "0.0 < ()")
         raises(TypeError, "0j < ()")
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to