gh-93973: Add all_errors to asyncio.create_connection (#93974)

Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
This commit is contained in:
Pamela Fox 2022-09-04 18:33:50 -07:00 committed by GitHub
parent ac18665472
commit a0ad63e70e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 54 additions and 2 deletions

View file

@ -980,7 +980,8 @@ class BaseEventLoop(events.AbstractEventLoop):
local_addr=None, server_hostname=None,
ssl_handshake_timeout=None,
ssl_shutdown_timeout=None,
happy_eyeballs_delay=None, interleave=None):
happy_eyeballs_delay=None, interleave=None,
all_errors=False):
"""Connect to a TCP server.
Create a streaming transport connection to a given internet host and
@ -1069,6 +1070,8 @@ class BaseEventLoop(events.AbstractEventLoop):
if sock is None:
exceptions = [exc for sub in exceptions for exc in sub]
if all_errors:
raise ExceptionGroup("create_connection failed", exceptions)
if len(exceptions) == 1:
raise exceptions[0]
else: