Replace deprecated athrow() signature in async generator wrapper — Closes #94#109
Merged
conradbzura merged 2 commits intowool-labs:mainfrom Mar 23, 2026
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace the legacy two-arg
athrow(type(exc), exc)calls with the single-argathrow(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.11requirement. This eliminates ~10DeprecationWarningemissions per integration test run.Closes #94
Proposed changes
Use single-arg athrow signature
Two call sites in
src/wool/runtime/routine/wrapper.pyforwarded exceptions to the underlying async generator usingathrow(type(exc), exc). Both are replaced withathrow(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
@routine-decorated async generator that catches a thrown exceptionathrow()is called with the exceptionDeprecationWarningExisting
athrowbehavioral tests (handled, unhandled, causing return, interleaved with send) remain unchanged and continue to pass.