@@ -1350,7 +1350,6 @@ insert_split_dict(PyInterpreterState *interp, PyDictObject *mp,
1350
1350
return -1 ;
1351
1351
}
1352
1352
assert (!_PyDict_HasSplitTable (mp ));
1353
- assert (DK_IS_UNICODE (keys ));
1354
1353
return insert_combined_dict (interp , mp , hash , key , value );
1355
1354
}
1356
1355
@@ -1609,7 +1608,7 @@ dictresize(PyInterpreterState *interp, PyDictObject *mp,
1609
1608
Py_ssize_t numentries = mp -> ma_used ;
1610
1609
1611
1610
if (oldvalues != NULL ) {
1612
- ASSERT_KEYS_LOCKED (oldkeys );
1611
+ LOCK_KEYS (oldkeys );
1613
1612
PyDictUnicodeEntry * oldentries = DK_UNICODE_ENTRIES (oldkeys );
1614
1613
/* Convert split table into new combined table.
1615
1614
* We must incref keys; we can transfer values.
@@ -1640,6 +1639,7 @@ dictresize(PyInterpreterState *interp, PyDictObject *mp,
1640
1639
}
1641
1640
build_indices_unicode (mp -> ma_keys , newentries , numentries );
1642
1641
}
1642
+ UNLOCK_KEYS (oldkeys );
1643
1643
dictkeys_decref (interp , oldkeys );
1644
1644
mp -> ma_values = NULL ;
1645
1645
free_values (oldvalues );
@@ -3998,14 +3998,8 @@ dict_popitem_impl(PyDictObject *self)
3998
3998
/* Convert split table to combined table */
3999
3999
if (_PyDict_HasSplitTable (self )) {
4000
4000
PyDictKeysObject * keys = self -> ma_keys ;
4001
- dictkeys_incref (keys );
4002
- LOCK_KEYS (keys );
4003
-
4004
- int status = dictresize (interp , self , DK_LOG_SIZE (self -> ma_keys ), 1 );
4005
- UNLOCK_KEYS (keys );
4006
- dictkeys_decref (interp , keys );
4007
4001
4008
- if (status < 0 ) {
4002
+ if (dictresize ( interp , self , DK_LOG_SIZE ( self -> ma_keys ), 1 ) < 0 ) {
4009
4003
Py_DECREF (res );
4010
4004
return NULL ;
4011
4005
}
0 commit comments