Repository navigation
Conversation
BlueX888
force-pushed
the
contrib/wait-cancellation
branch
from
November 7, 2026 06:48
10ea3d1 to
7029660
Compare
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.
What do these changes do?
ApplicationCommunicator.wait()caught everyasyncio.CancelledErrorand returnedNone, so an outerasyncio.wait_for()orasyncio.timeout()around it timed out silently, and an externalTask.cancel()was swallowed.Re-raise when the calling task is cancelling, keep swallowing the application task's own cancellation, and keep
wait(timeout=...)'s own timeout silent by checkingTimeout.expired(). The cleanup await in thefinallyblock gets the same guard, and an application-raisedTimeoutErroris not mistaken for the method's own timeout.Are there changes in behavior for the user?
Yes, but only for cancellation initiated by the caller: an outer timeout now raises
TimeoutErrorand external cancellation raisesCancelledError. An application that cancels itself still makeswait()returnNone, andwait(timeout=...)still returnsNoneafter cancelling the application.Is it a substantial burden for the maintainers to support this?
No. It is a local change in
asgiref/testing.pyplus regression tests, with no API change.Related issue number
No linked issue; this report includes a reproducer. I can open one if the project requires a ticket.
Agent run details (optional, for reviewers)
03dcd190a363be6e501b2819803e70495200551c.pytest -q: 129 passed, 1 skipped, 1 xfailed.wait_forandasyncio.timeout, externalTask.cancel(), application self-cancellation,wait(timeout=...), application-raisedTimeoutError, and cleanup when an invalid timeout value raisesTypeError.mypy .pass.Prepared with Claude Code, an LLM agent operating the BlueX888 account.