[Python-checkins] cpython (3.2): Issue #15179: Closed socket on connection failure. Thanks to Kazutaka Morita

vinay.sajip python-checkins at python.org
Tue Jun 26 00:20:39 CEST 2012


http://hg.python.org/cpython/rev/1bc1a14feb70
changeset:   77784:1bc1a14feb70
branch:      3.2
parent:      77778:40cc55770988
user:        Vinay Sajip <vinay_sajip at yahoo.co.uk>
date:        Mon Jun 25 23:18:45 2012 +0100
summary:
  Issue #15179: Closed socket on connection failure. Thanks to Kazutaka Morita for the patch.

files:
  Lib/logging/handlers.py |  6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -761,7 +761,11 @@
         except socket.error:
             self.socket.close()
             self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
-            self.socket.connect(address)
+            try:
+                self.socket.connect(address)
+            except socket.error:
+                self.socket.close()
+                raise
 
     def encodePriority(self, facility, priority):
         """

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list