[pypy-commit] pypy py3k: adapt to py3's __hash/eq/cmp__ changes

pjenvey noreply at buildbot.pypy.org
Fri Jul 19 01:31:10 CEST 2013


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r65475:b8ebf0cf310f
Date: 2013-07-18 16:30 -0700
http://bitbucket.org/pypy/pypy/changeset/b8ebf0cf310f/

Log:	adapt to py3's __hash/eq/cmp__ changes

diff --git a/pypy/objspace/std/test/test_identityset.py b/pypy/objspace/std/test/test_identityset.py
--- a/pypy/objspace/std/test/test_identityset.py
+++ b/pypy/objspace/std/test/test_identityset.py
@@ -23,10 +23,7 @@
         class CustomEq(object):
             def __eq__(self, other):
                 return True
-
-        class CustomCmp (object):
-            def __cmp__(self, other):
-                return 0
+            __hash__ = object.__hash__
 
         class CustomHash(object):
             def __hash__(self):
@@ -40,7 +37,7 @@
 
         assert self.uses_strategy('IdentitySetStrategy',s)
 
-        for cls in [CustomEq,CustomCmp,CustomHash]:
+        for cls in [CustomEq,CustomHash]:
             s = set()
             s.add(cls())
             assert not self.uses_strategy('IdentitySetStrategy',s)
@@ -64,6 +61,7 @@
         class NotIdent(object):
             def __eq__(self,other):
                 pass
+            __hash__ = object.__hash__
 
         s = set([X(),X()])
         s.add('foo')


More information about the pypy-commit mailing list