summaryrefslogtreecommitdiffstats
path: root/Lib/logging/handlers.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2012-03-23 14:36:22 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2012-03-23 14:36:22 (GMT)
commitee64b28cf44c14bfa4f7626357b8d99d2110e404 (patch)
tree26b99afc51251ca4a48478005b3de88987496fb9 /Lib/logging/handlers.py
parenta3481e70d188edf846cac6244ddc7f1178c6ff50 (diff)
downloadcpython-ee64b28cf44c14bfa4f7626357b8d99d2110e404.zip
cpython-ee64b28cf44c14bfa4f7626357b8d99d2110e404.tar.gz
cpython-ee64b28cf44c14bfa4f7626357b8d99d2110e404.tar.bz2
Closes #14314: backported fix.
Diffstat (limited to 'Lib/logging/handlers.py')
-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 73ce031..fed8c93 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -857,6 +857,7 @@ class SMTPHandler(logging.Handler):
self.toaddrs = toaddrs
self.subject = subject
self.secure = secure
+ self._timeout = 5.0
def getSubject(self, record):
"""
@@ -879,7 +880,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,