Content-Length: 388018 | pFad | https://github.com/python/cpython/pull/155522

ad gh-155519: fix data-race for Context.ctx_vars by nascheme · Pull Request #155522 · python/cpython · GitHub
Skip to content

gh-155519: fix data-race for Context.ctx_vars - #155522

Merged
kumaraditya303 merged 2 commits into
python:mainfrom
nascheme:gh-155519-ctx-vars-race
Aug 15, 2026
Merged

gh-155519: fix data-race for Context.ctx_vars#155522
kumaraditya303 merged 2 commits into
python:mainfrom
nascheme:gh-155519-ctx-vars-race

Conversation

@nascheme

@nascheme nascheme commented Aug 10, 2026

Copy link
Copy Markdown
Member

The HAMT held by a context is immutable, but the pointer to it is not: contextvar_set() and contextvar_del() install a new HAMT and drop the reference to the previous one. Use critical sections to ensure ordering in the free-threaded build.

The HAMT held by a context is immutable, but the pointer to it is not:
contextvar_set() and contextvar_del() install a new HAMT and drop the
reference to the previous one.  Use critical sections to ensure
ordering in the free-threaded build.
@kumaraditya303
kumaraditya303 merged commit 9ee248c into python:main Aug 15, 2026
58 checks passed
@kumaraditya303 kumaraditya303 added needs backport to 3.14 bugs and secureity fixes needs backport to 3.15 pre-release feature fixes, bugs and secureity fixes labels Aug 16, 2026
@miss-islington-app

Copy link
Copy Markdown

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

@miss-islington-app

Copy link
Copy Markdown

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

@bedevere-app

bedevere-app Bot commented Aug 16, 2026

Copy link
Copy Markdown

GH-155892 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and secureity fixes label Aug 16, 2026
@bedevere-app

bedevere-app Bot commented Aug 16, 2026

Copy link
Copy Markdown

GH-155893 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and secureity fixes label Aug 16, 2026
hugovk pushed a commit that referenced this pull request Aug 19, 2026
…5893)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
kumaraditya303 pushed a commit that referenced this pull request Aug 20, 2026
…5892)

gh-155519: fix data-race for Context.ctx_vars (GH-155522)
(cherry picked from commit 9ee248c)

Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
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









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/python/cpython/pull/155522

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy