-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-142518: Document thread-safety guarantees of dict operations #144184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| .. versionchanged:: 3.8 | ||
| Dictionaries are now reversible. | ||
|
|
||
| .. admonition:: Thread safety |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I
| .. 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.
| across threads. See :ref:`freethreading-python-howto` for more information. | ||
|
|
||
|
|
||
| .. seealso:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest having this before the thread safety.
| These operations may compare keys using :meth:`~object.__eq__`, which can | ||
| execute arbitrary Python code. During such comparisons, the dictionary may | ||
| be modified by another thread. For built-in types like :class:`str`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC devguide recommenda avoiding double spaces after periods for new documentation but I am not entirely sure.
📚 Documentation preview 📚: https://cpython-previews--144184.org.readthedocs.build/