mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
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:
parent
f733a013b2
commit
b9f4ad3a9a
3 changed files with 29 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue