diff --git a/Lib/ssl.py b/Lib/ssl.py index 560cfef..5fe1432 100644 --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -701,7 +701,7 @@ class SSLSocket(socket): self.ciphers = ciphers # Can't use sock.type as other flags (such as SOCK_NONBLOCK) get # mixed in. - if sock.getsockopt(SOL_SOCKET, SO_TYPE) != SOCK_STREAM: + if sock is not None and sock.getsockopt(SOL_SOCKET, SO_TYPE) != SOCK_STREAM: raise NotImplementedError("only stream sockets are supported") if server_side and server_hostname: raise ValueError("server_hostname can only be specified "