mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-74166: Add option to get all errors from socket.create_connection (GH-91586)
This commit is contained in:
parent
0860b26a4f
commit
39a54ba638
5 changed files with 48 additions and 10 deletions
|
@ -660,7 +660,7 @@ The following functions all create :ref:`socket objects <socket-objects>`.
|
|||
Windows support added.
|
||||
|
||||
|
||||
.. function:: create_connection(address[, timeout[, source_address]])
|
||||
.. function:: create_connection(address[, timeout[, source_address[, all_errors]]])
|
||||
|
||||
Connect to a TCP service listening on the internet *address* (a 2-tuple
|
||||
``(host, port)``), and return the socket object. This is a higher-level
|
||||
|
@ -679,9 +679,18 @@ The following functions all create :ref:`socket objects <socket-objects>`.
|
|||
socket to bind to as its source address before connecting. If host or port
|
||||
are '' or 0 respectively the OS default behavior will be used.
|
||||
|
||||
When a connection cannot be created, an exception is raised. By default,
|
||||
it is the exception from the last address in the list. If *all_errors*
|
||||
is ``True``, it is an :exc:`ExceptionGroup` containing the errors of all
|
||||
attempts.
|
||||
|
||||
.. versionchanged:: 3.2
|
||||
*source_address* was added.
|
||||
|
||||
.. versionchanged:: 3.11
|
||||
*all_errors* was added.
|
||||
|
||||
|
||||
.. function:: create_server(address, *, family=AF_INET, backlog=None, reuse_port=False, dualstack_ipv6=False)
|
||||
|
||||
Convenience function which creates a TCP socket bound to *address* (a 2-tuple
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue