Skip to content

Conversation

@colesbury
Copy link
Contributor

@colesburycolesbury commented Dec 24, 2025

@colesbury
Copy link
ContributorAuthor

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.

@colesburycolesbury requested a review from mpageDecember 24, 2025 00:24
@colesburycolesbury 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
ContributorAuthor

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
ContributorAuthor

That will be fixed in #143112

@colesburycolesbury merged commit 594a463 into python:mainDec 24, 2025
54 checks passed
@colesburycolesbury deleted the gh-120321-tsan-races branch December 24, 2025 21:10
Sign up for freeto 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

@colesbury@kumaraditya303