Skip to content

Replace deprecated athrow() signature in async generator wrapper — Closes #94#109

Merged
conradbzura merged 2 commits intowool-labs:mainfrom
conradbzura:94-replace-deprecated-athrow
Mar 23, 2026
Merged

Replace deprecated athrow() signature in async generator wrapper — Closes #94#109
conradbzura merged 2 commits intowool-labs:mainfrom
conradbzura:94-replace-deprecated-athrow

Conversation

@conradbzura
Copy link
Copy Markdown
Contributor

Summary

Replace the legacy two-arg athrow(type(exc), exc) calls with the single-arg athrow(exc) form in the async generator wrapper. Python 3.12 deprecated the (type, value, traceback) signature, and the single-arg form has been supported since Python 3.8 — well within the project's >=3.11 requirement. This eliminates ~10 DeprecationWarning emissions per integration test run.

Closes #94

Proposed changes

Use single-arg athrow signature

Two call sites in src/wool/runtime/routine/wrapper.py forwarded exceptions to the underlying async generator using athrow(type(exc), exc). Both are replaced with athrow(exc), which is the modern form and avoids the deprecation warning introduced in Python 3.12.

The first site is in async_generator_wrapper (the dispatch path), the second in _stream (the local execution path). Both paths are exercised by existing tests.

Test cases

# Test Suite Given When Then Coverage Target
1 (module) A @routine-decorated async generator that catches a thrown exception athrow() is called with the exception It should not emit a DeprecationWarning Regression guard for #94

Existing athrow behavioral tests (handled, unhandled, causing return, interleaved with send) remain unchanged and continue to pass.

Python 3.12 deprecated the (type, value, traceback) signature for
athrow(), producing a DeprecationWarning on every async generator
throw. The single-arg athrow(exc) form has been supported since
Python 3.8 and is compatible with the project's >=3.11 requirement.
Asserts that athrow on a @routine-decorated async generator does not
emit a DeprecationWarning, guarding against reintroduction of the
legacy two-arg signature.
@conradbzura conradbzura marked this pull request as ready for review March 23, 2026 15:34
@conradbzura conradbzura merged commit 43b99c9 into wool-labs:main Mar 23, 2026
4 checks passed
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.

Replace deprecated athrow() signature in async generator wrapper

1 participant