Skip to content

gh-125221: Fix free-threading data race in object.__reduce_ex__ #125267

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

Merged
merged 2 commits into from
Oct 11, 2024

Conversation

colesbury
Copy link
Contributor

@colesbury colesbury commented Oct 10, 2024

The lazy initialization of objreduce wasn't thread-safe in the free threading build. Instead, initialize the interpreter's cached objreduce field as part of the initialization of interpreter's types.

The lazy initialization of `objreduce` wasn't thread-safe in the free
threading build. Instead, initialize the interpreter's cached `objreduce`
field as part of the initialization of interpreter's types.
@colesbury colesbury marked this pull request as ready for review October 10, 2024 15:44
@colesbury colesbury requested a review from vstinner October 10, 2024 15:44
Copy link
Contributor

@mpage mpage left a comment

Choose a reason for hiding this comment

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

LGTM!

@kumaraditya303 kumaraditya303 merged commit b12e992 into python:main Oct 11, 2024
40 checks passed
@miss-islington-app
Copy link

Thanks @colesbury for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 11, 2024
@bedevere-app
Copy link

bedevere-app bot commented Oct 11, 2024

GH-125305 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Oct 11, 2024
kumaraditya303 pushed a commit that referenced this pull request Oct 11, 2024
…__` (GH-125267) (#125305)

gh-125221: Fix free-threading data race in `object.__reduce_ex__` (GH-125267)
(cherry picked from commit b12e992)

Co-authored-by: Sam Gross <[email protected]>
@colesbury colesbury deleted the gh-125221-obj-reduce branch December 4, 2024 20:23
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.

3 participants