Bug #1576657: when setting a KeyError for a tuple key, make sure that
the tuple isn't used as the "exception arguments tuple".
diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py
index bbca798..218f7cc 100644
--- a/Lib/test/test_dict.py
+++ b/Lib/test/test_dict.py
@@ -444,6 +444,16 @@
else:
self.fail_("g[42] didn't raise KeyError")
+ def test_tuple_keyerror(self):
+ # SF #1576657
+ d = {}
+ try:
+ d[(1,)]
+ except KeyError, e:
+ self.assertEqual(e.args, ((1,),))
+ else:
+ self.fail("missing KeyError")
+
from test import mapping_tests