Bug #1576657: when setting a KeyError for a tuple key, make sure that

the tuple isn't used as the "exception arguments tuple".
This commit is contained in:
Georg Brandl 2006-10-29 18:31:42 +00:00
parent f733a013b2
commit b9f4ad3a9a
3 changed files with 29 additions and 3 deletions

View file

@ -444,6 +444,16 @@ class DictTest(unittest.TestCase):
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