Why ? Why can't those parts be 'if it exists'-ed out ? We do it for SSL support. I'm only comfortable with the IPv6 patch if it's optional, or can at least be disabled. I haven't looked at the patch, but why is getaddrinfo absolutely necessary, if the code works without it now, too ?
getaddrinfo offers protocol-independent address lookup. It is necessary to use that API to support AF_INET and AF_INET6 transparently in application code. itojun proposes to change a number of standard library modules. Please have a look at the actual patch for details; the typical change will look like this (for httplib) diff -u -r1.35 httplib.py --- Lib/httplib.py 2001/06/01 16:25:38 1.35 +++ Lib/httplib.py 2001/06/24 04:41:48 @@ -357,10 +357,22 @@ def connect(self): """Connect to the host and port specified in __init__.""" - self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - if self.debuglevel > 0: - print "connect: (%s, %s)" % (self.host, self.port) - self.sock.connect((self.host, self.port)) + for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM): + af, socktype, proto, canonname, sa = res + try: + self.sock = socket.socket(af, socktype, proto) + if self.debuglevel > 0: + print "connect: (%s, %s)" % (self.host, self.port) + self.sock.connect(sa) + except socket.error, msg: + if self.debuglevel > 0: + print 'connect fail:', (self.host, self.port) + self.sock.close() + self.sock = None + continue + break + if not self.sock: + raise socket.error, msg def close(self): """Close the connection to the HTTP server.""" As you can see, the modified code can simultaneously access both IPv4 and IPv6 hosts, and will pick whatever it can connect to best. Without getaddrinfo, httplib would continue to support IPv4 hosts only. The IPv6 support itself is absolutely optional. If it is not available, getaddrinfo will never return IPv6 addresses, or propose AF_INET6 as the address family.
What about the zillion other 'obscure' ports ? OS/2 ? Palm ? MacOS 9 ;) If this patch can't be zero-impact-if-necessary, I'm a firm -1 on it. But I don't think it can't, it just takes more work.
Depends on what zero-impact-if-necessary means to you. The patch, as it stands, can be fixed to compile on all systems that are currently supported. It cannot be fixed to be taken completely out (unless you literally do that: take it out). I don't plan to fight for it too much. Please have a look at the code itself, and try to cooperate on integrating it. Don't reject it outright without having even looked at it. If I get strong rejections from everybody, I'll just withdraw it and feel sorry for the time I've already spent with it. Regards, Martin