]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Try to repair more new buildbot failures in "x86 OpenBSD trunk", due
authorTim Peters <tim.peters@gmail.com>
Tue, 11 Apr 2006 00:43:27 +0000 (00:43 +0000)
committerTim Peters <tim.peters@gmail.com>
Tue, 11 Apr 2006 00:43:27 +0000 (00:43 +0000)
to that id() can now return a Python long on a 32-bit box that allocates
addresses "with the sign bit set".

test_set.py test_subclass_with_custom_hash():  it's never been portably
legal for a __hash__() method to return id(self), but on 32-bit boxes
that never caused a problem before it became possible for id() to
return a Python long.  Changed __hash__ here to return a Python int
regardless of platform.

test_descr.py specials():
    vereq(hash(c1), id(c1))
has never been a correct test -- just removed it (hash() is always
a Python int; id() may be a Python long).

Lib/test/test_set.py

index 1a2cdda1157b034c678f71140c3bae9fa9d81384..0268be272d8252d6de276d7e8434050885f5cc7d 100644 (file)
@@ -224,7 +224,7 @@ class TestJointOps(unittest.TestCase):
         # Bug #1257731
         class H(self.thetype):
             def __hash__(self):
-                return id(self)
+                return int(id(self) & 0x7fffffff)
         s=H()
         f=set()
         f.add(s)