Is it asyncio.StreamReader.read/readexactly cancellation-safe?

Hi,

Asyncio streams Api does not support timeouts what is common use case. The way to handle with tomeouts is to cancel task when timeout elapsed (e.g. using asyncio.wait_for). The question is whether the asyncio streams Api is cancellation-safe in the sense that it leaves stream in correct state and doesn’t lose any stream data when read (or any other stream api method) task is cancelled.

1 Like