@@ -265,8 +265,8 @@ static_ext_type_lookup(PyInterpreterState *interp, size_t index,
265265 assert (index < _Py_MAX_MANAGED_STATIC_EXT_TYPES );
266266
267267 size_t full_index = index + _Py_MAX_MANAGED_STATIC_BUILTIN_TYPES ;
268- int64_t interp_count =
269- _PyRuntime .types .managed_static .types [full_index ].interp_count ;
268+ int64_t interp_count = _Py_atomic_load_int64 (
269+ & _PyRuntime .types .managed_static .types [full_index ].interp_count ) ;
270270 assert ((interp_count == 0 ) ==
271271 (_PyRuntime .types .managed_static .types [full_index ].type == NULL ));
272272 * p_interp_count = interp_count ;
@@ -343,7 +343,7 @@ managed_static_type_state_init(PyInterpreterState *interp, PyTypeObject *self,
343343 : index + _Py_MAX_MANAGED_STATIC_BUILTIN_TYPES ;
344344
345345 assert ((initial == 1 ) ==
346- (_PyRuntime .types .managed_static .types [full_index ].interp_count == 0 ));
346+ (_Py_atomic_load_int64 ( & _PyRuntime .types .managed_static .types [full_index ].interp_count ) == 0 ));
347347 (void )_Py_atomic_add_int64 (
348348 & _PyRuntime .types .managed_static .types [full_index ].interp_count , 1 );
349349
@@ -392,7 +392,7 @@ managed_static_type_state_clear(PyInterpreterState *interp, PyTypeObject *self,
392392 : & (interp -> types .for_extensions .initialized [index ]);
393393 assert (state != NULL );
394394
395- assert (_PyRuntime .types .managed_static .types [full_index ].interp_count > 0 );
395+ assert (_Py_atomic_load_int64 ( & _PyRuntime .types .managed_static .types [full_index ].interp_count ) > 0 );
396396 assert (_PyRuntime .types .managed_static .types [full_index ].type == state -> type );
397397
398398 assert (state -> type != NULL );
@@ -402,7 +402,7 @@ managed_static_type_state_clear(PyInterpreterState *interp, PyTypeObject *self,
402402 (void )_Py_atomic_add_int64 (
403403 & _PyRuntime .types .managed_static .types [full_index ].interp_count , -1 );
404404 if (final ) {
405- assert (!_PyRuntime .types .managed_static .types [full_index ].interp_count );
405+ assert (!_Py_atomic_load_int64 ( & _PyRuntime .types .managed_static .types [full_index ].interp_count ) );
406406 _PyRuntime .types .managed_static .types [full_index ].type = NULL ;
407407
408408 managed_static_type_index_clear (self );
@@ -9037,17 +9037,13 @@ type_ready_set_new(PyTypeObject *type, int initial)
90379037 if (initial ) {
90389038 // tp_new is NULL: inherit tp_new from base
90399039 type -> tp_new = base -> tp_new ;
9040- } else {
9041- assert (type -> tp_new = base -> tp_new );
90429040 }
90439041 }
90449042 }
90459043 else {
90469044 // Py_TPFLAGS_DISALLOW_INSTANTIATION sets tp_new to NULL
90479045 if (initial ) {
90489046 type -> tp_new = NULL ;
9049- } else {
9050- assert (type -> tp_new == NULL );
90519047 }
90529048 }
90539049 return 0 ;
@@ -9183,7 +9179,10 @@ type_ready(PyTypeObject *type, int initial)
91839179 /* All done -- set the ready flag */
91849180 if (initial ) {
91859181 type_add_flags (type , Py_TPFLAGS_READY );
9182+ } else {
9183+ assert (type -> tp_flags & Py_TPFLAGS_READY );
91869184 }
9185+
91879186 stop_readying (type );
91889187
91899188 assert (_PyType_CheckConsistency (type ));
0 commit comments