| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
|
||
| fut = ensure_future(fut, loop=loop) | ||
| fut.add_done_callback(cb) | ||
| async def inner(): |
There was a problem hiding this comment.
@asvetlov I've been having a go at this branch in bf594bd
you need to special case None in asyncio.wait_for(
| async def inner(): | |
| if timeout is None: | |
| return await fut | |
| async def inner(): |
and then special case 0 in timeouts.timeout see https://gist.github.com/graingert/ea2546b23b32be5a4493a9a115db2eff#file-timeout_bug-py-L6
Sorry, something went wrong.
| raise exceptions.TimeoutError() from exc | ||
| finally: | ||
| timeout_handle.cancel() | ||
| return await create_task(inner()) |
There was a problem hiding this comment.
I don't think this extra create_task is worth it, the tests it passes are equivalent to:
async def wait_for(fut, delay):
if delay is None:
return await fut
if delay <= 0:
if asyncio.iscoroutine(fut):
fut.close()
raise TimeoutError
Sorry, something went wrong.
There was a problem hiding this comment.
I think it would be better to skip this create_task and delete the tests that fail
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
No description provided.