[New-bugs-announce] [issue22601] asyncio: loop.run_forever() should consume exception of the temporary task

STINNER Victor report at bugs.python.org
Fri Oct 10 14:07:33 CEST 2014


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 <report at bugs.python.org>
<http://bugs.python.org/issue22601>
_______________________________________


More information about the New-bugs-announce mailing list