summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2025-02-27 18:57:19 (GMT)
committerGitHub <noreply@github.com>2025-02-27 18:57:19 (GMT)
commit7aeaa5af2c32f1f87b59f36f89e19284e24b26b9 (patch)
treed0f0151722c8ae1dc9db292618e73f017be5c089 /Python/pythonrun.c
parente06bebb87e1b33f7251196e1ddb566f528c3fc98 (diff)
downloadcpython-7aeaa5af2c32f1f87b59f36f89e19284e24b26b9.zip
cpython-7aeaa5af2c32f1f87b59f36f89e19284e24b26b9.tar.gz
cpython-7aeaa5af2c32f1f87b59f36f89e19284e24b26b9.tar.bz2
gh-130091: Reorder `_PyThreadState_Attach` to avoid data race (gh-130092)
This moves `tstate_activate()` down to avoid a data race in the free threading build on the `_PyRuntime`'s thread-local `autoTSSkey`. This key is deleted during runtime finalization, which may happen concurrently with a call to `_PyThreadState_Attach`. The earlier `tstate_try/wait_attach` ensures that the thread is blocked before it attempts to access the deleted `autoTSSkey`. This fixes a TSAN reported data race in `test_threading.test_import_from_another_thread`.
Diffstat (limited to 'Python/pythonrun.c')
0 files changed, 0 insertions, 0 deletions