summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/SocketServer.py1
-rw-r--r--Lib/test/test_socketserver.py1
-rw-r--r--Misc/NEWS3
3 files changed, 5 insertions, 0 deletions
diff --git a/Lib/SocketServer.py b/Lib/SocketServer.py
index 3a74c44..7d9b9a5 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 e4cbb2b..6232175 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 ef54039..262972c 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -156,6 +156,9 @@ Core and builtins
Library
-------
+- Bug #1531963: Make SocketServer.TCPServer's server_address always
+ be equal to calling getsockname() on the server's socket.
+
- Bug #1651235: When a tuple was passed to a ctypes function call,
Python would crash instead of raising an error.