Skip to content

gh-142518: add thread safety annotations for tuple C-API#148012

Open
kumaraditya303 wants to merge 6 commits intopython:mainfrom
kumaraditya303:tuple-capi
Open

gh-142518: add thread safety annotations for tuple C-API#148012
kumaraditya303 wants to merge 6 commits intopython:mainfrom
kumaraditya303:tuple-capi

Conversation

@kumaraditya303
Copy link
Copy Markdown
Contributor

@kumaraditya303 kumaraditya303 commented Apr 2, 2026

Copy link
Copy Markdown
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't PyTuple_SetItem thread-safe on an "existing" tuple if the tuple is uniquely referenced?

Co-authored-by: Peter Bierma <[email protected]>
@kumaraditya303
Copy link
Copy Markdown
Contributor Author

Isn't PyTuple_SetItem thread-safe on an "existing" tuple if the tuple is uniquely referenced?

Yes, that's what the docs mean by "This function should only be used to fill in brand new tuples" as brand new tuples are uniquely referenced.

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