https://github.com/python/cpython/commit/83b1e74e0be9fc38a3e7863c38218b38d561062c commit: 83b1e74e0be9fc38a3e7863c38218b38d561062c branch: 3.14 author: Miss Islington (bot) <[email protected]> committer: gpshead <[email protected]> date: 2026-11-12T00:10:28Z summary:
[3.14] gh-161763: Correct SSL docs for unconnected client sockets (#GH-61772) (#161839) gh-161763: Correct SSL docs for unconnected client sockets (#GH-61772) * gh-161763: Correct SSL docs for unconnected client sockets * gh-161763: Qualify SSL socket method references (cherry picked from commit f112215dd7ef054655093e880384dbaed0fbfc66) Co-authored-by: Damian Shaw <[email protected]> files: M Doc/library/ssl.rst diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index 7ab6f9b749364f..31de505a9b1884 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -104,6 +104,7 @@ Client socket example with custom context and IPv4:: with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as sock: with context.wrap_socket(sock, server_hostname=hostname) as ssock: + ssock.connect((hostname, 443)) print(ssock.version()) @@ -1823,13 +1824,12 @@ to speed up repeated connections from the same clients. The parameter ``server_side`` is a boolean which identifies whether server-side or client-side behavior is desired from this socket. - For client-side sockets, the context construction is lazy; if the - underlying socket isn't connected yet, the context construction will be - performed after :meth:`connect` is called on the socket. For - server-side sockets, if the socket has no remote peer, it is assumed + For client-side sockets, if *sock* is not yet connected, the underlying + SSL object is created when :meth:`~socket.socket.connect` is called. + For server-side sockets, if the socket has no remote peer, it is assumed to be a listening socket, and the server-side SSL wrapping is automatically performed on client connections accepted via the - :meth:`accept` method. The method may raise :exc:`SSLError`. + :meth:`~socket.socket.accept` method. The method may raise :exc:`SSLError`. On client connections, the optional parameter *server_hostname* specifies the hostname of the service which we are connecting to. This allows a _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
