Clang-20 detects a data race between the unlock and the non-atomic
read of the lock state. Use a relaxed load for the assertion to avoid
the race.
(cherry picked from commit
f11ec6e643f54f4ee698f7dfc878812a315f2af4)
Co-authored-by: Sam Gross <colesbury@gmail.com>
} while (v != 3 && iters < 200);
// both the "locked" and the "has parked" bits should be set
- assert(test_data.m._bits == 3);
+ v = _Py_atomic_load_uint8_relaxed(&test_data.m._bits);
+ assert(v == 3);
PyMutex_Unlock(&test_data.m);
PyEvent_Wait(&test_data.done);