diff -r fbe29ca8192b Lib/test/test_dict.py --- a/Lib/test/test_dict.py Tue Sep 13 13:27:41 2016 +0200 +++ b/Lib/test/test_dict.py Tue Sep 13 22:26:21 2016 +0800 @@ -892,6 +892,15 @@ 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) diff -r fbe29ca8192b Objects/dictobject.c --- a/Objects/dictobject.c Tue Sep 13 13:27:41 2016 +0200 +++ b/Objects/dictobject.c Tue Sep 13 22:26:21 2016 +0800 @@ -1721,7 +1721,7 @@ 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;