From ed82e6f6a21d6110f9a4eeec87f7dde4feb1c37f Mon Sep 17 00:00:00 2001 From: Elvis Pranskevichus Date: Thu, 6 Jul 2023 16:42:09 -0700 Subject: [PATCH] Fix closing of connection discarded by session target attrs `asyncio.gather` takes a variadic, not an iterable and `return_exceptions` was masking the issue. --- asyncpg/connect_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asyncpg/connect_utils.py b/asyncpg/connect_utils.py index 8b29c0fc..6d788f60 100644 --- a/asyncpg/connect_utils.py +++ b/asyncpg/connect_utils.py @@ -1003,7 +1003,7 @@ async def _connect(*, loop, timeout, connection_class, record_class, **kwargs): chosen_connection = random.choice(candidates) await asyncio.gather( - (c.close() for c in candidates if c is not chosen_connection), + *(c.close() for c in candidates if c is not chosen_connection), return_exceptions=True )