summaryrefslogtreecommitdiffstats
path: root/Lib/socketserver.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/socketserver.py')
-rw-r--r--Lib/socketserver.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/socketserver.py b/Lib/socketserver.py
index 3d58590..f1b0e4a 100644
--- a/Lib/socketserver.py
+++ b/Lib/socketserver.py
@@ -439,8 +439,12 @@ class TCPServer(BaseServer):
self.socket = socket.socket(self.address_family,
self.socket_type)
if bind_and_activate:
- self.server_bind()
- self.server_activate()
+ try:
+ self.server_bind()
+ self.server_activate()
+ except:
+ self.server_close()
+ raise
def server_bind(self):
"""Called by constructor to bind the socket.