aio-libs/async-timeout

There is no way to set `timeout=0` for immediate cancelation

Closed this issue · 4 comments

timeout=0 will be set to None due https://github.com/aio-libs/async-timeout/blob/master/async_timeout/__init__.py#L22

timeout=0 or any special flag for instant timeout can be useful

As well it makes different behaviour with asyncio.wait_for, cuz it supports timeout=0

https://github.com/aio-libs/async-timeout/blob/master/async_timeout/__init__.py#L22

what about implementing timeout=async_timeout.immediate ? If it makes sense I'll do PR

We could distinguish None from 0.

It will huge backword incopability

I think it makes sense to copy behaviour asyncio.wait_for, as well there is a patch for asyncio itself
python/cpython#3703 which changes little bit timeout=0. Ill do pr when asyncio.wait_for changes will be accepted or declined

Closed by #28