diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2008-07-15 15:46:38 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2008-07-15 15:46:38 (GMT) |
commit | d1abd25ed8e14a64da21d17ece73c49390b9b083 (patch) | |
tree | 21c0fbf58c0b0a05268ccdf538716f2f75dd5576 /Lib/test/test_descr.py | |
parent | e65282114e96efb9e7eee77c57244943b746f6fe (diff) | |
download | cpython-d1abd25ed8e14a64da21d17ece73c49390b9b083.zip cpython-d1abd25ed8e14a64da21d17ece73c49390b9b083.tar.gz cpython-d1abd25ed8e14a64da21d17ece73c49390b9b083.tar.bz2 |
Manual forward port of 64962 - use PyObject_HashNotImplemented as a tp_hash level indicator that the default hash implementation has not been inherited
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r-- | Lib/test/test_descr.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index bfbb400..3c0bae0 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -3070,12 +3070,20 @@ order (MRO) for bases """ self.assertEqual(hash(d), 144) D.__hash__ = lambda self: 100 self.assertEqual(hash(d), 100) + D.__hash__ = None + self.assertRaises(TypeError, hash, d) del D.__hash__ self.assertEqual(hash(d), 144) + B.__hash__ = None + self.assertRaises(TypeError, hash, d) del B.__hash__ self.assertEqual(hash(d), 314) + C.__hash__ = None + self.assertRaises(TypeError, hash, d) del C.__hash__ self.assertEqual(hash(d), 42) + A.__hash__ = None + self.assertRaises(TypeError, hash, d) del A.__hash__ self.assertEqual(hash(d), orig_hash) d.foo = 42 |