[issue28274] asyncio does not call exception handler if task stored

R. David Murray report at bugs.python.org
Sun Sep 25 15:21:46 EDT 2016


R. David Murray added the comment:

In the first case, once the loop has run the task it no longer has a reference to it, and it gets GCed.  The __del__ method of the task calls your exception handler.  In the second case, you have a reference to it, so __del__ does not get called.

If you want the exception to be realized in the second case, you have to yield from it somewhere in your program.

----------
nosy: +r.david.murray
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28274>
_______________________________________


More information about the Python-bugs-list mailing list