Message261696
When calling asyncio.ensure_future() on a coroutine, and if the loop is closed, ensure_future() will raise a RuntimeError.
However, it still creates a Task, which will generate a RuntimeWarning that we can’t fix since there is no way to cancel the Task.
Here is the code to reproduce the bug:
import asyncio
l = asyncio.get_event_loop()
l.close()
async def foo():
pass
try:
# Since the exception raises here, fut is never set
# so we can't call fut.cancel()
fut = asyncio.ensure_future(foo())
except RuntimeError:
pass
# stderr:
# aio.py:12: RuntimeWarning: coroutine 'foo' was never awaited
# pass |
|
Date |
User |
Action |
Args |
2016-03-13 11:46:10 | gordon | set | recipients:
+ gordon, gvanrossum, vstinner, yselivanov |
2016-03-13 11:46:10 | gordon | set | messageid: <1457869570.39.0.866858008064.issue26552@psf.upfronthosting.co.za> |
2016-03-13 11:46:10 | gordon | link | issue26552 messages |
2016-03-13 11:46:10 | gordon | create | |
|