Index: Lib/socket.py =================================================================== --- Lib/socket.py (revision 7292) +++ Lib/socket.py (working copy) @@ -587,11 +587,11 @@ if type == SOCK_STREAM: if protocol != 0: assert protocol == IPPROTO_TCP, "Only IPPROTO_TCP supported on SOCK_STREAM sockets" - return _tcpsocket() + return _tcpsocket(family, type, protocol) else: if protocol != 0: assert protocol == IPPROTO_UDP, "Only IPPROTO_UDP supported on SOCK_DGRAM sockets" - return _udpsocket() + return _udpsocket(family, type, protocol) # # Attempt to provide IDNA (RFC 3490) support. @@ -912,9 +912,15 @@ ostream = None local_addr = None server = 0 + family = AF_INET + type = SOCK_STREAM + proto = 0 - def __init__(self): + def __init__(self, family = AF_INET, type = SOCK_STREAM, protocol=0): _nonblocking_api_mixin.__init__(self) + self.family = family + self.type = type + self.proto = protocol def bind(self, addr): assert not self.sock_impl @@ -1059,9 +1065,15 @@ sock_impl = None connected = False + family = AF_INET + type = SOCK_STREAM + proto = 0 - def __init__(self): + def __init__(self, family=AF_INET, type=SOCK_STREAM, protocol=0): _nonblocking_api_mixin.__init__(self) + self.family = family + self.type = type + self.proto = protocol def bind(self, addr): try: