From: Collin Winter Date: Sat, 10 Mar 2007 03:31:44 +0000 (+0000) Subject: Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling... X-Git-Tag: v2.5.1c1~64 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=86d8d3520d674bf66000e2930adf6df53f3fb0fa;p=thirdparty%2FPython%2Fcpython.git Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket. Fixed by patch #1545011. Backported from r54253. --- diff --git a/Lib/SocketServer.py b/Lib/SocketServer.py index 3a74c444ba18..7d9b9a536a94 100644 --- a/Lib/SocketServer.py +++ b/Lib/SocketServer.py @@ -339,6 +339,7 @@ class TCPServer(BaseServer): if self.allow_reuse_address: self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.socket.bind(self.server_address) + self.server_address = self.socket.getsockname() def server_activate(self): """Called by constructor to activate the server. diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py index e4cbb2b58888..62321757068d 100644 --- a/Lib/test/test_socketserver.py +++ b/Lib/test/test_socketserver.py @@ -84,6 +84,7 @@ class ServerThread(threading.Thread): addr = getattr(svr, 'server_address') if addr: self.__addr = addr + assert self.__addr == svr.socket.getsockname() if verbose: print "thread: serving three times" svr.serve_a_few() if verbose: print "thread: done" diff --git a/Misc/NEWS b/Misc/NEWS index 3c0c34bd0b97..156c03ccdf4f 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -196,6 +196,11 @@ Extension Modules Library ------- + +- Bug #1531963: Make SocketServer.TCPServer's server_address always + be equal to calling getsockname() on the server's socket. Fixed by patch + #1545011. + - Bug #1651235: When a tuple was passed to a ctypes function call, Python would crash instead of raising an error.