Skip to content

fix: Stop unconditionally importing contextvars#6625

Open
alexander-alderman-webb wants to merge 2 commits into
masterfrom
webb/contextvar
Open

fix: Stop unconditionally importing contextvars#6625
alexander-alderman-webb wants to merge 2 commits into
masterfrom
webb/contextvar

Conversation

@alexander-alderman-webb

@alexander-alderman-webb alexander-alderman-webb commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Description

Fix regression from 2604409.

contextvars was added to the standard library in Python 3.7, and sentry-sdk does not declare any dependencies which allow it to resolve contextvars at import time.

Issues

Reminders

Comment thread sentry_sdk/utils.py Outdated
@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review June 22, 2026 12:46
@alexander-alderman-webb alexander-alderman-webb requested a review from a team as a code owner June 22, 2026 12:46
@github-actions

Copy link
Copy Markdown
Contributor

Codecov Results 📊

91382 passed | ⏭️ 6136 skipped | Total: 97518 | Pass Rate: 93.71% | Execution Time: 326m 30s

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 2404 uncovered lines.
✅ Project coverage is 89.88%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    89.85%    89.88%    +0.03%
==========================================
  Files          192       192         —
  Lines        23745     23744        -1
  Branches      8198      8198         —
==========================================
+ Hits         21334     21340        +6
- Misses        2411      2404        -7
- Partials      1344      1344         —

Generated by Codecov Action

@ericapisani ericapisani left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. I noticed that the pydantic integration still directly imports from contextvars, but I think it shouldn't be an issue given our minimum support version of python for that is 3.10

@alexander-alderman-webb alexander-alderman-webb changed the title fix: Stop unconditionally importing contextvars fix: Stop unconditionally importing contextvars Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants