Commit 7aeaa5a
authored
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`.
1 parent e06bebb commit 7aeaa5a
1 file changed
+1
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2099 | 2099 | | |
2100 | 2100 | | |
2101 | 2101 | | |
2102 | | - | |
2103 | | - | |
2104 | 2102 | | |
2105 | 2103 | | |
2106 | 2104 | | |
| 2105 | + | |
2107 | 2106 | | |
2108 | 2107 | | |
2109 | 2108 | | |
| |||
0 commit comments