diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-09-13 14:56:38 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-09-13 14:56:38 (GMT) |
commit | d0ad11f6b4b0c617b5b57f0dbc97a2a173f6309b (patch) | |
tree | 633b2e82a609b4142d7d7a84f8d37c55610e9d18 /Lib | |
parent | 9926480b6aaab60d2c5f710e7fc60061c52f6f08 (diff) | |
download | cpython-d0ad11f6b4b0c617b5b57f0dbc97a2a173f6309b.zip cpython-d0ad11f6b4b0c617b5b57f0dbc97a2a173f6309b.tar.gz cpython-d0ad11f6b4b0c617b5b57f0dbc97a2a173f6309b.tar.bz2 |
Fix _PyDict_Pop() on pending key
Issue #28120: Fix dict.pop() for splitted dictionary when trying to remove a
"pending key" (Not yet inserted in split-table).
Patch by Xiang Zhang.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_dict.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py index fb954c8..ed66ddb 100644 --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -892,6 +892,15 @@ class DictTest(unittest.TestCase): self.assertEqual(list(b), ['x', 'y', 'z']) @support.cpython_only + def test_splittable_pop_pending(self): + """pop a pending key in a splitted table should not crash""" + a, b = self.make_shared_key_dict(2) + + a['a'] = 4 + with self.assertRaises(KeyError): + b.pop('a') + + @support.cpython_only def test_splittable_popitem(self): """split table must be combined when d.popitem()""" a, b = self.make_shared_key_dict(2) |