@@ -11253,7 +11253,7 @@ _PyType_InitSlotDefs(PyInterpreterState *interp)
1125311253 if (interp != interp -> runtime -> interpreters .main ) {
1125411254 return 0 ;
1125511255 }
11256- PyObject * bytes = NULL ;
11256+ PyObject * bytearray = NULL ;
1125711257 PyObject * cache = PyDict_New ();
1125811258 if (!cache ) {
1125911259 return -1 ;
@@ -11262,51 +11262,43 @@ _PyType_InitSlotDefs(PyInterpreterState *interp)
1126211262 pytype_slotdef * p ;
1126311263 Py_ssize_t idx = 0 ;
1126411264 for (p = slotdefs ; p -> name_strobj ; p ++ , idx ++ ) {
11265- Py_hash_t hash = _PyObject_HashFast (p -> name_strobj );
11266- if (hash == -1 ) {
11267- goto error ;
11268- }
1126911265 assert (idx < 255 );
1127011266
11271- if (_PyDict_GetItemRef_KnownHash_LockHeld ((PyDictObject * )cache ,
11272- p -> name_strobj , hash ,
11273- & bytes ) < 0 ) {
11267+ if (PyDict_GetItemRef (cache , p -> name_strobj , & bytearray ) < 0 ) {
1127411268 goto error ;
1127511269 }
1127611270
11277- if (!bytes ) {
11271+ if (!bytearray ) {
1127811272 Py_ssize_t size = sizeof (uint8_t ) * (1 + MAX_EQUIV );
11279- bytes = PyBytes_FromStringAndSize (NULL , size );
11280- if (!bytes ) {
11273+ bytearray = PyByteArray_FromStringAndSize (NULL , size );
11274+ if (!bytearray ) {
1128111275 goto error ;
1128211276 }
1128311277
11284- uint8_t * data = (uint8_t * )PyBytes_AS_STRING ( bytes );
11278+ uint8_t * data = (uint8_t * )PyByteArray_AS_STRING ( bytearray );
1128511279 data [0 ] = 0 ;
1128611280
11287- if (_PyDict_SetItem_KnownHash_LockHeld ((PyDictObject * )cache ,
11288- p -> name_strobj ,
11289- bytes , hash ) < 0 ) {
11281+ if (PyDict_SetItem (cache , p -> name_strobj , bytearray ) < 0 ) {
1129011282 goto error ;
1129111283 }
1129211284 }
1129311285
11294- assert (PyBytes_CheckExact ( bytes ));
11295- uint8_t * data = (uint8_t * )PyBytes_AS_STRING ( bytes );
11286+ assert (PyByteArray_CheckExact ( bytearray ));
11287+ uint8_t * data = (uint8_t * )PyByteArray_AS_STRING ( bytearray );
1129611288
1129711289 data [0 ] += 1 ;
1129811290 assert (data [0 ] < MAX_EQUIV );
1129911291
1130011292 data [data [0 ]] = (uint8_t )idx ;
1130111293
11302- Py_CLEAR (bytes );
11294+ Py_CLEAR (bytearray );
1130311295 }
1130411296
1130511297 Py_ssize_t pos = 0 ;
1130611298 PyObject * key = NULL ;
1130711299 PyObject * value = NULL ;
1130811300 while (PyDict_Next (cache , & pos , & key , & value )) {
11309- uint8_t * data = (uint8_t * )PyBytes_AS_STRING (value );
11301+ uint8_t * data = (uint8_t * )PyByteArray_AS_STRING (value );
1131011302 uint8_t n = data [0 ];
1131111303 uint8_t i = 0 ;
1131211304 for (; i < n ; i ++ ) {
@@ -11319,7 +11311,7 @@ _PyType_InitSlotDefs(PyInterpreterState *interp)
1131911311 return 0 ;
1132011312
1132111313error :
11322- Py_XDECREF (bytes );
11314+ Py_XDECREF (bytearray );
1132311315 Py_DECREF (cache );
1132411316 return -1 ;
1132511317}
0 commit comments