New submission from STINNER Victor: BaseEventLoop.run_forever() creates a temporary task when it gets a coroutine object. If the coroutine raises a base exception, it is stored in the temporary task (task.set_exception(exc)). run_forever() doesn't catch the exception, which is the expected behaviour.
The problem is that the temporary task still holds the exception, whereas the caller doesn't have access to this temporary task object. As a result, a warning is logger. I propose to simply drop the exception from the task object (consume it). The call will get it anyway, it's not catched. Attached patch implements this idea with a unit test. ---------- components: asyncio files: run_forever.patch keywords: patch messages: 228994 nosy: gvanrossum, haypo, yselivanov priority: normal severity: normal status: open title: asyncio: loop.run_forever() should consume exception of the temporary task versions: Python 3.4, Python 3.5 Added file: http://bugs.python.org/file36866/run_forever.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22601> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com