classification
Title: TimeoutError behavior changes on async.wait_for from python3.7
Type: behavior Stage:
Components: asyncio Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Yerken Tussupbekov, asvetlov, yselivanov
Priority: normal Keywords:

Created on 2020-07-29 22:17 by Yerken Tussupbekov, last changed 2020-07-29 22:28 by yselivanov.

Messages (2)
msg374589 - (view) Author: Yerken Tussupbekov (Yerken Tussupbekov) Date: 2020-07-29 22:17
```
import asyncio
from concurrent import futures


logging.basicConfig(
    level=logging.DEBUG,
    format="[%(asctime)s %(name)s %(levelname)s]: %(message)s",
    datefmt="%H:%M:%S %d-%m-%y",
)
logger: logging.Logger = logging.getLogger("ideahitme")


async def too_long() -> None:
    await asyncio.sleep(2)


async def run() -> None:
    try:
        await asyncio.wait_for(too_long(), 1)
    except futures.TimeoutError:
        logger.info("concurrent.futures.TimeoutError happened")
    except asyncio.TimeoutError:
        logger.info("asyncio.TimeoutError happened")


if __name__ == "__main__":
    asyncio.run(run())
```

In python 3.8.4 running this script will print:

asyncio.TimeoutError happened

In python 3.7.5 running this script will print:

concurrent.futures.TimeoutError happened

This is a breaking change which I didn't see announced in the changelog. What is the expected behavior here ?
msg374591 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2020-07-29 22:28
> In python 3.8.4 running this script will print:

> asyncio.TimeoutError happened

This is the expected behavior in 3.8.

> This is a breaking change which I didn't see announced in the changelog.

Yeah, looks like this wasn't mentioned in what's new or elsewhere in the docs. :(

Do you want to submit a PR to fix that?
History
Date User Action Args
2020-07-29 22:28:39yselivanovsetmessages: + msg374591
2020-07-29 22:17:28Yerken Tussupbekovcreate