-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
AsyncGenerator breaks when not iterated fully with RuntimeError("can't send non-None value to a just-started coroutine") #82194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Version: Python 3.7.3 When I run this code: import asyncio
class TestAsyncGenerator:
def __init__(self):
pass
async def aiter(self):
yield 1
yield 2
async def main():
gen = TestAsyncGenerator()
async for number in gen.aiter():
break
asyncio.run(main()) # unhandled exception during asyncio.run() shutdown There is a warning message that I don't expect to see. I would expect breaking from an async iteration to behave as if breaking from a normal iteration - that is, no problems. However, I see the warning message shown above. Am I missing something? Otherwise, I believe this is a bug. Thanks! |
I have a PR for the fix. I've added 'release blocker' priority to don't miss this bugfix for the next release. |
Note that 3.7.5rc1 is scheduled to be tagged today so we need to make a decision on whether to hold the release for a fix. From a quick test, it looks like the behavior was introduced in 3.7.1 as the test does not fail for me with 3.7.0. If so, that seems to meet the criteria for a maintenance release regression and thus potentially a release blocker. |
Thanks, Ned. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: