Skip to content

gh-142518: Annotate PyDict_* C APIs for thread safety#145875

Open
lysnikolaou wants to merge 1 commit intopython:mainfrom
lysnikolaou:annotate-pydict
Open

gh-142518: Annotate PyDict_* C APIs for thread safety#145875
lysnikolaou wants to merge 1 commit intopython:mainfrom
lysnikolaou:annotate-pydict

Conversation

@lysnikolaou
Copy link
Member

@lysnikolaou lysnikolaou commented Mar 12, 2026

# Dictionary objects (Doc/c-api/dict.rst)

# Type checks - read ob_type pointer, always safe
PyDict_Check:atomic:
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think these need to be annotated. PyDict_Check falls in the category of type checks, and reading type of a object is safe in free-threading in general, we can perhaps add this separately but it doesn't look useful to add this to every type check function

Copy link
Member Author

Choose a reason for hiding this comment

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

My view is more information is better than less. Since it's just one line in a .dat file and not something that will require a substantial maintenance effort, it's good to have it. Making things more easily discoverable is a strong argument.

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