From 38ba76dc4230f28e01145b18ecfe635da2c4a5d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= Date: Sun, 30 Jul 2023 14:04:14 +0300 Subject: [PATCH] Don't raise a new CancelledError if the future was cancelled --- asyncpg/compat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asyncpg/compat.py b/asyncpg/compat.py index b9b13fa5..b77019bb 100644 --- a/asyncpg/compat.py +++ b/asyncpg/compat.py @@ -59,7 +59,7 @@ async def wait_for(fut, timeout): try: return await asyncio.wait_for(fut, timeout) except asyncio.CancelledError: - if fut.done(): + if fut.done() and not fut.cancelled(): return fut.result() else: raise