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 twisteroid ambassador
Recipients asvetlov, salgado, twisteroid ambassador, yselivanov
Date 2020-10-19.08:07:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1603094868.39.0.345794207802.issue39116@roundup.psfhosted.org>
In-reply-to
Content
This problem still exists on Python 3.9 and latest Windows 10.

I tried to catch the GeneratorExit and turn it into a normal Exception, and things only got weirder from here. Often several lines later another await statement would raise another GeneratorExit, such as writer.write() or even asyncio.sleep(). Doesn't matter whether I catch the additional GeneratorExit or not, once code exits this coroutine a RuntimeError('coroutine ignored GeneratorExit') is raised. And it doesn't matter what I do with this RuntimeError, the outermost coroutine's Task always generates an 'asyncio Task was destroyed but it is pending!' error message.

Taking a step back from this specific problem. Does a "casual" user of asyncio need to worry about handling GeneratorExits? Can I assume that I should not see GeneratorExits in user code?
History
Date User Action Args
2020-10-19 08:07:48twisteroid ambassadorsetrecipients: + twisteroid ambassador, asvetlov, salgado, yselivanov
2020-10-19 08:07:48twisteroid ambassadorsetmessageid: <1603094868.39.0.345794207802.issue39116@roundup.psfhosted.org>
2020-10-19 08:07:48twisteroid ambassadorlinkissue39116 messages
2020-10-19 08:07:48twisteroid ambassadorcreate