[New-bugs-announce] [issue29432] wait_for(gather(...)) logs weird error message

Martin Teichmann report at bugs.python.org
Fri Feb 3 06:25:24 EST 2017


New submission from Martin Teichmann:

when waiting for a gather that times out, everything works as expected, yet a weird error message is logged. To give a minimal example:

    import asyncio

    @asyncio.coroutine
    def main():
        try:
            sleep = asyncio.sleep(0.2)
            yield from asyncio.wait_for(asyncio.gather(sleep),
                                        timeout=0.1)
        except asyncio.TimeoutError:
            print("timed out: fine")
        yield from asyncio.sleep(0.1)

    asyncio.get_event_loop().run_until_complete(main())

This outputs:

    timed out: fine
    _GatheringFuture exception was never retrieved
    future: <_GatheringFuture finished exception=CancelledError()>
    concurrent.futures._base.CancelledError

As you can see, I used the pre-3.5 syntax so I could test whether it works on older systems. No, it doesn't.

I wrote a unit test for this problem, unfortunately I couldn't solve it yet.

----------
components: asyncio
messages: 286858
nosy: Martin.Teichmann, gvanrossum, yselivanov
priority: normal
pull_requests: 24
severity: normal
status: open
title: wait_for(gather(...)) logs weird error message
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7

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


More information about the New-bugs-announce mailing list