summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2012-03-23 14:33:00 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2012-03-23 14:33:00 (GMT)
commit50d6f54b1aae4aadf6f080148ec2858663312cd7 (patch)
tree55e873c21194724afec58c1f3ef00595f1fb06a7 /Lib/logging
parentea605cd1526431380e4b15c2ea58dd81ff18a88d (diff)
downloadcpython-50d6f54b1aae4aadf6f080148ec2858663312cd7.zip
cpython-50d6f54b1aae4aadf6f080148ec2858663312cd7.tar.gz
cpython-50d6f54b1aae4aadf6f080148ec2858663312cd7.tar.bz2
Closes #14314: backported fix.
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/handlers.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index d140048..3ff324d 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -868,6 +868,7 @@ class SMTPHandler(logging.Handler):
self.toaddrs = toaddrs
self.subject = subject
self.secure = secure
+ self._timeout = 5.0
def getSubject(self, record):
"""
@@ -890,7 +891,7 @@ class SMTPHandler(logging.Handler):
port = self.mailport
if not port:
port = smtplib.SMTP_PORT
- smtp = smtplib.SMTP(self.mailhost, port)
+ smtp = smtplib.SMTP(self.mailhost, port, timeout=self._timeout)
msg = self.format(record)
msg = "From: %s\r\nTo: %s\r\nSubject: %s\r\nDate: %s\r\n\r\n%s" % (
self.fromaddr,