Skip to content
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

[3.13] gh-120858: PyDict_Next should not lock the dict (GH-120859) #120964

Merged
merged 1 commit into from
Jun 24, 2024

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jun 24, 2024

PyDict_Next no longer locks the dictionary in the free-threaded build. Locking
around individual PyDict_Next calls is not sufficient because the function
returns borrowed references and because it allows concurrent modifications
during the iteraiton loop.

The internal locking also interferes with correct external synchronization
because it may suspend outer critical sections created by the caller.
(cherry picked from commit 375b723)

Co-authored-by: Sam Gross colesbury@gmail.com


📚 Documentation preview 📚: https://cpython-previews--120964.org.readthedocs.build/

PyDict_Next no longer locks the dictionary in the free-threaded build. Locking
around individual PyDict_Next calls is not sufficient because the function
returns borrowed references and because it allows concurrent modifications
during the iteraiton loop.

The internal locking also interferes with correct external synchronization
because it may suspend outer critical sections created by the caller.
(cherry picked from commit 375b723)

Co-authored-by: Sam Gross <colesbury@gmail.com>
@colesbury colesbury enabled auto-merge (squash) June 24, 2024 18:15
@colesbury colesbury merged commit 0a77058 into python:3.13 Jun 24, 2024
37 checks passed
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