From acfa4a8398ec09735a16b8875833d3b336cb34ec Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 17 Mar 2021 09:56:53 +0100 Subject: [PATCH] mtest: remove pointless try/except from try_wait_one asyncio.wait does not return an asyncio.TimeoutError, so there is no exception to catch. --- mesonbuild/mtest.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index af5ad6d0f..50e93f5a7 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -1129,11 +1129,9 @@ def check_testdata(objs: T.List[TestSerialisation]) -> T.List[TestSerialisation] # Custom waiting primitives for asyncio async def try_wait_one(*awaitables: T.Any, timeout: T.Optional[T.Union[int, float]]) -> None: - try: - await asyncio.wait(awaitables, - timeout=timeout, return_when=asyncio.FIRST_COMPLETED) - except asyncio.TimeoutError: - pass + """Wait for completion of one of the given futures, ignoring timeouts.""" + await asyncio.wait(awaitables, + timeout=timeout, return_when=asyncio.FIRST_COMPLETED) async def queue_iter(q: 'asyncio.Queue[T.Optional[str]]') -> T.AsyncIterator[str]: while True: