Skip to content

gh-121546: Disable contextvar caching on free-threading build - #121740

Merged
Fidget-Spinner merged 2 commits into
python:mainfrom
Fidget-Spinner:disable_cached_contextvars
Jul 15, 2024
Merged

Fidget-Spinner merged 2 commits into
python:mainfrom
Fidget-Spinner:disable_cached_contextvars

Conversation

@Fidget-Spinner

@Fidget-Spinner Fidget-Spinner commented Jul 14, 2024 •

Copy link
Copy Markdown
Member

I tested this by running the repros in the issue on a TSAN build for 2-3 minutes each. No races reported.

@colesbury colesbury left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is the right approach for now, especially for 3.13. LGTM, with two comments:

  • There's an unused variable warning (see comment below)
  • Consider adding the #ifndef guards in struct _pycontextvarobject around the cache fields as well to make it more clear that they are not used in the free-threaded build.

Comment thread Python/context.c Resolved
@Fidget-Spinner
Fidget-Spinner merged commit e904300 into python:main Jul 15, 2024
@miss-islington-app

Copy link
Copy Markdown

Thanks @Fidget-Spinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@Fidget-Spinner
Fidget-Spinner deleted the disable_cached_contextvars branch July 15, 2024 18:58
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 15, 2024
…ythonGH-121740)

(cherry picked from commit e904300)

Co-authored-by: Ken Jin <kenjin@python.org>
@bedevere-app

bedevere-app Bot commented Jul 15, 2024

Copy link
Copy Markdown

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

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Jul 15, 2024
colesbury pushed a commit that referenced this pull request Jul 15, 2024
…H-121740) (#121808)

gh-121546: Disable contextvar caching on free-threading build (GH-121740)
(cherry picked from commit e904300)

Co-authored-by: Ken Jin <kenjin@python.org>
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