self.assertEqual(list(a), ['x', 'z', 'y'])
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()"""
ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, &hashpos);
if (ix == DKIX_ERROR)
return NULL;
- if (ix == DKIX_EMPTY) {
+ if (ix == DKIX_EMPTY || *value_addr == NULL) {
if (deflt) {
Py_INCREF(deflt);
return deflt;