diff options
author | Guido van Rossum <guido@python.org> | 2006-08-21 23:36:26 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-08-21 23:36:26 +0000 |
commit | 6762480dff9c92ce96a2cb47aa36e99cf8fedcc0 (patch) | |
tree | cf838aa4ca377c973d00bba0d0e84ab51d97f64a /Lib/test/test_dict.py | |
parent | cea26cded225d11e72c60e8cd7a4a15cf78611c5 (diff) | |
download | cpython-6762480dff9c92ce96a2cb47aa36e99cf8fedcc0.tar.gz |
Change the way __hash__ is inherited; when __eq__ or __cmp__ is overridden
but __hash__ is not, set __hash__ explicitly to None (and tp_hash to NULL).
All unit tests pass now!
Diffstat (limited to 'Lib/test/test_dict.py')
-rw-r--r-- | Lib/test/test_dict.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py index f16884607e..7295f41b78 100644 --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -76,6 +76,8 @@ class DictTest(unittest.TestCase): class BadEq(object): def __eq__(self, other): raise Exc() + def __hash__(self): + return 24 d = {} d[BadEq()] = 42 @@ -375,6 +377,8 @@ class DictTest(unittest.TestCase): class BadCmp(object): def __eq__(self, other): raise Exc() + def __hash__(self): + return 42 d1 = {BadCmp(): 1} d2 = {1: 1} |