Author: Antonio Cuni <[email protected]>
Branch: py3k
Changeset: r53008:3a26b5491705
Date: 2012-02-28 23:39 +0100
http://bitbucket.org/pypy/pypy/changeset/3a26b5491705/

Log:    kill the cases about longs. Also, instances of classes which define
        __eq__ but not __hash__ are unhashable in py3k. Fix the test, which
        now passes with -A but fails on py.py

diff --git a/pypy/objspace/test/test_descriptor.py 
b/pypy/objspace/test/test_descriptor.py
--- a/pypy/objspace/test/test_descriptor.py
+++ b/pypy/objspace/test/test_descriptor.py
@@ -110,7 +110,7 @@
         # useless result).
         class B(object):
             def __eq__(self, other): pass 
-        hash(B())
+        raises(TypeError, "hash(B())") # because we define __eq__ but not 
__hash__
 
         # same as above for __cmp__
         class C(object):
@@ -121,26 +121,12 @@
             def __hash__(self): 
                 return "something"
         raises(TypeError, hash, E())
-        class F: # can return long
-            def __hash__(self):
-                return long(2**33)
-        assert hash(F()) == hash(2**33) # 2.5 behavior
 
         class G:
             def __hash__(self):
                 return 1
         assert isinstance(hash(G()), int)
 
-        # __hash__ can return a subclass of long, but the fact that it's
-        # a subclass is ignored
-        class mylong(long):
-            def __hash__(self):
-                return 0
-        class H(object):
-            def __hash__(self):
-                return mylong(42)
-        assert hash(H()) == hash(42L)
-
         # don't return a subclass of int, either
         class myint(int):
             pass
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to