Skip to content

Conversation

@colesbury
Copy link
Contributor

@colesbury colesbury commented Dec 24, 2025

@colesbury
Copy link
Contributor Author

This is the same thing as #142995, but I missed a few cases. Again, I think these are false positives in the sense that TSan treats failed compare-exchanges as if they are modifications, when they don't perform any modification on failure.

@colesbury colesbury requested a review from mpage December 24, 2025 00:24
@colesbury colesbury marked this pull request as ready for review December 24, 2025 00:24
@kumaraditya303
Copy link
Contributor

In _PyGen_Finalize there are a few non-atomic reads of gi_frame_state, does that need fixing as well?

@colesbury
Copy link
Contributor Author

No, _PyGen_Finalize is called when there are no other references to the generator (except cycles), so there's no concurrent compare-exchanges on gi_frame_state.

@kumaraditya303
Copy link
Contributor

kumaraditya303 commented Dec 24, 2025

No, _PyGen_Finalize is called when there are no other references to the generator (except cycles), so there's no concurrent compare-exchanges on gi_frame_state.

It is possible that _PyGen_Finalize gets called from frame.clear though so IIUC it is not guaranteed to be called only when there are no other references to generator.

_PyGen_Finalize((PyObject *)gen);

@colesbury
Copy link
Contributor Author

That will be fixed in #143112

@colesbury colesbury merged commit 594a463 into python:main Dec 24, 2025
54 checks passed
@colesbury colesbury deleted the gh-120321-tsan-races branch December 24, 2025 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants