[issue1664] nntplib is not IPv6-capable

Derek Morr report at bugs.python.org
Tue Dec 30 06:01:58 CET 2008


Derek Morr <derekmorr at psu.edu> added the comment:

Yes. The patch is against 2.6. It uses the socket.create_connection() 
helper function, which was added in 2.6. See http://svn.python.org/view?
rev=54546&view=rev for the commit message.

If you really want to apply it to 2.5, it's trivial to adapt the patch. 
Just replace the call to create_connection() with something like this:

    msg = "getaddrinfo returns an empty list"
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
        af, socktype, proto, canonname, sa = res
        sock = None
        try:
            sock = socket(af, socktype, proto)
            if timeout is not _GLOBAL_DEFAULT_TIMEOUT:
                sock.settimeout(timeout)
            sock.connect(sa)
            self.sock = sock

        except error, msg:
            if sock is not None:
                sock.close()

    raise error, msg

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1664>
_______________________________________


More information about the Python-bugs-list mailing list