Skip to content

fix(mypyc): isolate compiled async exception state - #710

Merged
cofin merged 2 commits into
mainfrom
fix/exc-handling-mypyc
Aug 17, 2026
Merged

fix(mypyc): isolate compiled async exception state#710
cofin merged 2 commits into
mainfrom
fix/exc-handling-mypyc

Conversation

@cofin

@cofin cofin commented Aug 17, 2026

Copy link
Copy Markdown
Member

Closes #702.

Compiled async operations could inherit an exception already being handled by the caller, causing a successful query to re-raise that ambient exception. This isolates affected operations in a fresh asyncio task while preserving async-only exception-handler mapping, pass-through, observability, cache, bulk, script, and streaming behavior across compiled adapters.

Also fixes Oracle guarded-import warnings in the documentation build and prepares the 0.61.1 patch release.

Validated with focused exception/smoke tests, Ruff, mypy, a warnings-as-errors Sphinx build, and the 179-module mypyc smoke.

@codecov-commenter

codecov-commenter commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.27027% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.65%. Comparing base (6a9e478) to head (a618431).

Files with missing lines Patch % Lines
sqlspec/driver/_async.py 82.05% 6 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #710   +/-   ##
=======================================
  Coverage   76.64%   76.65%           
=======================================
  Files         488      488           
  Lines       69508    69524   +16     
  Branches     9613     9615    +2     
=======================================
+ Hits        53275    53294   +19     
+ Misses      12803    12800    -3     
  Partials     3430     3430           
Flag Coverage Δ
integration 60.29% <95.27%> (+0.02%) ⬆️
py3.10 74.92% <95.27%> (+0.02%) ⬆️
py3.11 74.92% <95.27%> (+<0.01%) ⬆️
py3.12 74.92% <95.27%> (+<0.01%) ⬆️
py3.13 74.92% <95.27%> (+0.01%) ⬆️
py3.14 75.84% <95.27%> (+0.01%) ⬆️
unit 64.31% <54.72%> (+0.02%) ⬆️

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

Files with missing lines Coverage Δ
sqlspec/adapters/aiomysql/core.py 73.68% <100.00%> (-0.09%) ⬇️
sqlspec/adapters/aiosqlite/core.py 80.79% <100.00%> (-0.06%) ⬇️
sqlspec/adapters/asyncmy/core.py 71.67% <100.00%> (-0.10%) ⬇️
sqlspec/adapters/asyncpg/core.py 78.18% <100.00%> (ø)
sqlspec/adapters/mysqlconnector/core.py 75.56% <100.00%> (-0.07%) ⬇️
sqlspec/adapters/oracledb/core.py 77.94% <100.00%> (-0.04%) ⬇️
sqlspec/adapters/psqlpy/core.py 77.03% <100.00%> (-0.05%) ⬇️
sqlspec/adapters/psycopg/core.py 92.43% <100.00%> (-0.03%) ⬇️
sqlspec/driver/_exception_handler.py 93.65% <100.00%> (+3.90%) ⬆️
sqlspec/driver/_async.py 80.66% <82.05%> (-0.04%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cofin cofin changed the title fix(#702): isolate compiled async exception state fix(mypyc): isolate compiled async exception state Aug 17, 2026
@cofin
cofin marked this pull request as ready for review August 17, 2026 19:59
@cofin
cofin merged commit 51b2581 into main Aug 17, 2026
41 of 43 checks passed
@cofin
cofin deleted the fix/exc-handling-mypyc branch August 17, 2026 19:59
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.

bug: compiled (mypyc) driver re-raises the ambient exception when a statement runs inside an except block — regression in 0.59.0

2 participants