Repository navigation
Accept any awaitable in WaitIterator - #3771
Open
Cherith1222 wants to merge 1 commit into
Open
Cherith1222 wants to merge 1 commit into
Cherith1222 wants to merge 1 commit into
Conversation
WaitIterator is documented to take awaitables, but its constructor passed each argument straight to future_add_done_callback, so a native coroutine failed with AttributeError. Convert each argument with convert_yielded. Futures are returned unchanged, so current_future and duplicate-future handling stay the same. Fixes tornadoweb#3001. AI-assisted (Cursor); not yet reviewed by a human.
This branch has not been deployed
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
gen.WaitIteratoris documented to accept any awaitable, but the constructor passed each argument straight tofuture_add_done_callback. A native coroutine then failed withAttributeError. Each argument is now converted withconvert_yielded. AFutureis returned unchanged, socurrent_futureand duplicate-future handling stay the same.Fixes #3001.
No changelog entry. Tornado adds those under a released version heading, and there is no unreleased section.
Test Plan
On Windows, Python 3.13:
python -m tornado.test.runtests tornado.test.gen_test.WaitIteratorTest→ before the change, the new test errored withAttributeError; after, 7 OK.python -m tornado.test.runtests tornado.test.gen_test→ 83 OK.--checkpassed ontornado/gen.pyandtornado/test/gen_test.py.Not run: mypy,
tox -e lint,docs,py3, the rest of the suite, and non-Windows platforms.AI assistance
Drafted with Cursor. The account owner authorized opening this pull request. Cherith reviewed this diff and confirmed it with the person who helped draft it. There is no
Co-authored-by,Reviewed-by, orSigned-off-bytrailer.