[3.13] gh-120524: Avoid a Race On _PyRuntime.types.managed_static.types[i].interp_count (gh-120529) by miss-islington · Pull Request #120657 · python/cpython
assert((initial == 1) == (_PyRuntime.types.managed_static.types[full_index].interp_count == 0)); _PyRuntime.types.managed_static.types[full_index].interp_count += 1; (void)_Py_atomic_add_int64( &_PyRuntime.types.managed_static.types[full_index].interp_count, 1);
if (initial) { assert(_PyRuntime.types.managed_static.types[full_index].type == NULL);
_PyRuntime.types.managed_static.types[full_index].interp_count -= 1; (void)_Py_atomic_add_int64( &_PyRuntime.types.managed_static.types[full_index].interp_count, -1); if (final) { assert(!_PyRuntime.types.managed_static.types[full_index].interp_count); _PyRuntime.types.managed_static.types[full_index].type = NULL;