# Bug report ### Bug description: This is a sub-issue of #153852 with the gist [here](https://gist.github.com/devdanzin/6b99ef6dce08ac64d8d1d379308a8f86). --- This reproducer crashes in free-threaded build with TSan: ```python import threading ROUNDS = 10000 box = [None] enter = threading.Barrier(2) leave = threading.Barrier(2) def reader(): for _ in range(ROUNDS): enter.wait() obj = box[0] obj.__getstate__() leave.wait() def writer(): for i in range(ROUNDS): box[0] = type(f"C{i}", (), {})() enter.wait() obj = box[0] setattr(obj, f"{i}", 1) leave.wait() threads = [threading.Thread(target=reader), threading.Thread(target=writer)] for thread in threads: thread.start() for thread in threads: thread.join() ``` See the gist for more information. ### CPython versions tested on: CPython main branch ### Operating systems tested on: Linux <!-- gh-linked-prs --> ### Linked PRs * gh-153882 * gh-154349 <!-- /gh-linked-prs -->
Activity
gh-153881: Atomically load `dk_nentries` in `_PyObject_IsInstanceDict…
[3.15] gh-153881: Atomically load `dk_nentries` in `_PyObject_IsInsta…