twisteroid ambassador <[email protected]> added the comment:
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?
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39116>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com