]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Closes #14314: backported fix.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Fri, 23 Mar 2012 14:36:22 +0000 (14:36 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Fri, 23 Mar 2012 14:36:22 +0000 (14:36 +0000)
Lib/logging/handlers.py

index 73ce031545d9727c662bbeb0ea6ec6a5cb1bfd31..fed8c9393d616166e7d56d1fd1918d95afb16f74 100644 (file)
@@ -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,