This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Michael Yoo
Recipients Michael Yoo, asvetlov, yselivanov
Date 2019-09-03.00:13:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1567469623.0.0.944759957345.issue38013@roundup.psfhosted.org>
In-reply-to
Content
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
# task: <Task finished coro=<<async_generator_athrow without __name__>()> exception=RuntimeError("can't send non-None value to a just-started coroutine")>
# RuntimeError: can't send non-None value to a just-started coroutine


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!
History
Date User Action Args
2019-09-03 00:13:43Michael Yoosetrecipients: + Michael Yoo, asvetlov, yselivanov
2019-09-03 00:13:43Michael Yoosetmessageid: <1567469623.0.0.944759957345.issue38013@roundup.psfhosted.org>
2019-09-03 00:13:42Michael Yoolinkissue38013 messages
2019-09-03 00:13:42Michael Yoocreate