Message378931
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? |
|
Date |
User |
Action |
Args |
2020-10-19 08:07:48 | twisteroid ambassador | set | recipients:
+ twisteroid ambassador, asvetlov, salgado, yselivanov |
2020-10-19 08:07:48 | twisteroid ambassador | set | messageid: <1603094868.39.0.345794207802.issue39116@roundup.psfhosted.org> |
2020-10-19 08:07:48 | twisteroid ambassador | link | issue39116 messages |
2020-10-19 08:07:48 | twisteroid ambassador | create | |
|