From a2baf53cbaada5448efa9d6b62f6448def75b497 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Sun, 13 Oct 2024 13:18:39 +0100 Subject: [PATCH] fix on trio on py < 3.13 --- src/anyio/_core/_sockets.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/anyio/_core/_sockets.py b/src/anyio/_core/_sockets.py index adcbd7f9..a225e6b9 100644 --- a/src/anyio/_core/_sockets.py +++ b/src/anyio/_core/_sockets.py @@ -223,11 +223,13 @@ async def try_connect(remote_host: str, event: Event) -> None: cause = ( oserrors[0] if len(oserrors) == 1 - else ExceptionGroup("multiple connection attempts failed", oserrors) + else ExceptionGroup( + "multiple connection attempts failed", oserrors.copy() + ) ) raise OSError("All connection attempts failed") from cause finally: - oserrors = [] + oserrors.clear() if tls or tls_hostname or ssl_context: try: