Skip to content

fix: Guard ReentrantLock against None task context#841

Merged
vdusek merged 1 commit intomasterfrom
fix/reentrant-lock-none-task-guard
Mar 26, 2026
Merged

fix: Guard ReentrantLock against None task context#841
vdusek merged 1 commit intomasterfrom
fix/reentrant-lock-none-task-guard

Conversation

@vdusek
Copy link
Copy Markdown
Contributor

@vdusek vdusek commented Mar 26, 2026

Summary

  • Add a runtime guard in ReentrantLock to raise RuntimeError when asyncio.current_task() returns None, preventing the lock from being silently bypassed due to None is None evaluating to True.

Test plan

  • Verify uv run poe check-code passes
  • Confirm ReentrantLock raises RuntimeError when called outside an asyncio.Task

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Mar 26, 2026
@vdusek vdusek self-assigned this Mar 26, 2026
@github-actions github-actions bot added this to the 137th sprint - Tooling team milestone Mar 26, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 26, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 86.48%. Comparing base (1610d0d) to head (d88d00e).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/apify/_utils.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@ ## master #841 +/- ## ========================================== + Coverage 86.40% 86.48% +0.07%  ========================================== Files 48 48 Lines 2906 2908 +2 ========================================== + Hits 2511 2515 +4  + Misses 395 393 -2 
Flag Coverage Δ
e2e 38.03% <0.00%> (-0.03%) ⬇️
integration 59.45% <0.00%> (-0.01%) ⬇️
unit 74.44% <50.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@vdusek vdusek requested a review from Pijukatel March 26, 2026 16:08
Copy link
Copy Markdown
Contributor

@janbuchar janbuchar left a comment

Choose a reason for hiding this comment

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

LGTM

@vdusek vdusek merged commit 193de10 into master Mar 26, 2026
31 checks passed
@vdusek vdusek deleted the fix/reentrant-lock-none-task-guard branch March 26, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

3 participants