summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorGiampaolo Rodola' <g.rodola@gmail.com>2012-10-15 14:57:37 (GMT)
committerGiampaolo Rodola' <g.rodola@gmail.com>2012-10-15 14:57:37 (GMT)
commit35eeb30adf4e01fa20cd95da1e4d4f80a4d1cd1d (patch)
tree260e467043faeb94538b93e0a6a2d6ceb25a362e /Lib/logging
parent7707f6fd328ebdad65671323aaed294d5a0fe1db (diff)
downloadcpython-35eeb30adf4e01fa20cd95da1e4d4f80a4d1cd1d.zip
cpython-35eeb30adf4e01fa20cd95da1e4d4f80a4d1cd1d.tar.gz
cpython-35eeb30adf4e01fa20cd95da1e4d4f80a4d1cd1d.tar.bz2
logging's SocketHandler: get rid of some legacy code and use the newer socket.create_connection() utility function
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/handlers.py10
1 files changed, 1 insertions, 9 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 2c5a634..fbc59fa 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -496,15 +496,7 @@ class SocketHandler(logging.Handler):
A factory method which allows subclasses to define the precise
type of socket they want.
"""
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- if hasattr(s, 'settimeout'):
- s.settimeout(timeout)
- try:
- s.connect((self.host, self.port))
- return s
- except socket.error:
- s.close()
- raise
+ return socket.create_connection((self.host, self.port), timeout=timeout)
def createSocket(self):
"""