Skip to content

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

Open
nascheme wants to merge 2 commits into
python:mainfrom
nascheme:gh-155519-ctx-vars-race
Open

gh-155519: fix data-race for Context.ctx_vars#155522
nascheme wants to merge 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.
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.

1 participant