diff options
author | Fred Drake <fdrake@acm.org> | 2000-08-31 19:48:52 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-08-31 19:48:52 (GMT) |
commit | 762c1cb3e351ed133055609ce48a3b140665ff37 (patch) | |
tree | b49990bcd9b24eefaadd16a02edcb2116d016759 /Lib/test/test_operations.py | |
parent | 65faf118b61a14caac332d9f44100502b34b7f98 (diff) | |
download | cpython-762c1cb3e351ed133055609ce48a3b140665ff37.zip cpython-762c1cb3e351ed133055609ce48a3b140665ff37.tar.gz cpython-762c1cb3e351ed133055609ce48a3b140665ff37.tar.bz2 |
Test case to exercise fix for error propogation bug in dictionarys.
Diffstat (limited to 'Lib/test/test_operations.py')
-rw-r--r-- | Lib/test/test_operations.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/Lib/test/test_operations.py b/Lib/test/test_operations.py index 1a75065..c14f480 100644 --- a/Lib/test/test_operations.py +++ b/Lib/test/test_operations.py @@ -2,4 +2,27 @@ print '3. Operations' -print 'XXX Not yet implemented' +print 'XXX Mostly not yet implemented' + + +print '3.1 Dictionary lookups succeed even if __cmp__() raises an exception' + +# SourceForge bug #112558: +# http://sourceforge.net/bugs/?func=detailbug&bug_id=112558&group_id=5470 + +class BadDictKey: + def __hash__(self): + return hash(self.__class__) + + def __cmp__(self, other): + if isinstance(other, self.__class__): + print "raising error" + raise RuntimeError, "gotcha" + return other + +d = {} +x1 = BadDictKey() +x2 = BadDictKey() +d[x1] = 1 +d[x2] = 2 +print "No exception passed through." |