[Python-apps-team] Bug#607441: #607441: python's SocketServer.TCPServer can't bind to IPv6

Daniel Kahn Gillmor dkg at fifthhorseman.net
Tue Dec 6 03:44:06 UTC 2011


reassign 607441 python2.7
found 607441 2.7.2-7
affects 607441 trac
thanks

python2.7 contains SocketServer.py, whose TCPServer implementation is
unable to bind to an IPv6 address:

In [14]: import SocketServer

In [15]: class myTCPHandler(SocketServer.BaseRequestHandler):
   ....:     def handle(self):
   ....:         self.request.send("hello\n")
   ....: 

In [16]: srv = SocketServer.TCPServer(('::1', 12345), myTCPHandler)
---------------------------------------------------------------------------
gaierror                                  Traceback (most recent call last)
/home/dkg/<ipython-input-16-60880957cca5> in <module>()
----> 1 srv = SocketServer.TCPServer(('::1', 12345), myTCPHandler)

/usr/lib/python2.7/SocketServer.pyc in __init__(self, server_address, RequestHandlerClass, bind_and_activate)
    406                                     self.socket_type)
    407         if bind_and_activate:
--> 408             self.server_bind()
    409             self.server_activate()
    410 

/usr/lib/python2.7/SocketServer.pyc in server_bind(self)
    417         if self.allow_reuse_address:
    418             self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
--> 419         self.socket.bind(self.server_address)
    420         self.server_address = self.socket.getsockname()
    421 

/usr/lib/python2.7/socket.pyc in meth(name, self, *args)
    222 
    223 def meth(name,self,*args):
--> 224     return getattr(self._sock,name)(*args)
    225 
    226 for _m in _socketmethods:

gaierror: [Errno -9] Address family for hostname not supported

In [17]: 

This causes trouble for tracd, as reported in
http://bugs.debian.org/607441

It would be good if SocketServerTCPServer could choose IPv6
automagically where needed.

Thanks for maintaining python in debian!

Regards,

        --dkg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 965 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/python-apps-team/attachments/20111205/52db58fa/attachment.pgp>


More information about the Python-apps-team mailing list