@@ -1339,7 +1339,6 @@ insert_split_dict(PyInterpreterState *interp, PyDictObject *mp,
1339
1339
return -1 ;
1340
1340
}
1341
1341
assert (!_PyDict_HasSplitTable (mp ));
1342
- assert (DK_IS_UNICODE (keys ));
1343
1342
return insert_combined_dict (interp , mp , hash , key , value );
1344
1343
}
1345
1344
@@ -1598,7 +1597,7 @@ dictresize(PyInterpreterState *interp, PyDictObject *mp,
1598
1597
Py_ssize_t numentries = mp -> ma_used ;
1599
1598
1600
1599
if (oldvalues != NULL ) {
1601
- ASSERT_KEYS_LOCKED (oldkeys );
1600
+ LOCK_KEYS (oldkeys );
1602
1601
PyDictUnicodeEntry * oldentries = DK_UNICODE_ENTRIES (oldkeys );
1603
1602
/* Convert split table into new combined table.
1604
1603
* We must incref keys; we can transfer values.
@@ -1629,6 +1628,7 @@ dictresize(PyInterpreterState *interp, PyDictObject *mp,
1629
1628
}
1630
1629
build_indices_unicode (mp -> ma_keys , newentries , numentries );
1631
1630
}
1631
+ UNLOCK_KEYS (oldkeys );
1632
1632
dictkeys_decref (interp , oldkeys );
1633
1633
mp -> ma_values = NULL ;
1634
1634
free_values (oldvalues );
@@ -3987,14 +3987,8 @@ dict_popitem_impl(PyDictObject *self)
3987
3987
/* Convert split table to combined table */
3988
3988
if (_PyDict_HasSplitTable (self )) {
3989
3989
PyDictKeysObject * keys = self -> ma_keys ;
3990
- dictkeys_incref (keys );
3991
- LOCK_KEYS (keys );
3992
-
3993
- int status = dictresize (interp , self , DK_LOG_SIZE (self -> ma_keys ), 1 );
3994
- UNLOCK_KEYS (keys );
3995
- dictkeys_decref (interp , keys );
3996
3990
3997
- if (status < 0 ) {
3991
+ if (dictresize ( interp , self , DK_LOG_SIZE ( self -> ma_keys ), 1 ) < 0 ) {
3998
3992
Py_DECREF (res );
3999
3993
return NULL ;
4000
3994
}
0 commit comments