Skip to content

gh-142518: Document thread-safety guarantees of dict operations#144184

Open
lysnikolaou wants to merge 7 commits intopython:mainfrom
lysnikolaou:dict-thread-safety
Open

gh-142518: Document thread-safety guarantees of dict operations#144184
lysnikolaou wants to merge 7 commits intopython:mainfrom
lysnikolaou:dict-thread-safety

Conversation

@lysnikolaou
Copy link
Member

@lysnikolaou lysnikolaou commented Jan 23, 2026

.. versionchanged:: 3.8
Dictionaries are now reversible.

.. admonition:: Thread safety
Copy link
Member

Choose a reason for hiding this comment

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

I

Suggested change
.. admonition:: Thread safety
.. _thread-safety-dict:
.. rubric:: Thread safety for dict objects

Admonition will create a big box which will not be good considering the size of the text. A rubric is like a title but without being it in the sidebar and a label allows us to link it.

Alternatively we can have a real section.

Copy link
Member Author

Choose a reason for hiding this comment

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

Consistency with list is a tiny bit more important here, I feel. Especially since we're planning to migrate all of this content into a new page.

Copy link
Member

Choose a reason for hiding this comment

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

I'd say that it is still wrong to have an admonition, especially considering how it is rendered online (it is, to me, disruptive to have a huge wall of text with borders and a colored background).

Copy link
Member Author

Choose a reason for hiding this comment

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

I tend to agree about the HTML rendering. Maybe removing it from list as well makes the most sense then?

Copy link
Member

Choose a reason for hiding this comment

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

Yes

Copy link
Member Author

Choose a reason for hiding this comment

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

Opened #144548 for list and I'll do it here as well.

@lysnikolaou
Copy link
Member Author

Could we have some more reviews on the content here?

cc @encukou if you have some spare cycles

@encukou encukou self-requested a review January 30, 2026 13:30
argument is a :class:`dict`, :class:`tuple`, :class:`set` or
:class:`frozenset`.

The following operations and function are lock-free and
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to define “lock-free”? (And/or “per-object lock”?)
Like “thread-safe” and “atomic”, I kinda know what that means, but if this was underlined I'd click through to read the definition.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, good idea! Opened #144548 for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants