diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index 4ef896ed5d6..cd8d5d2f746 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -343,7 +343,7 @@ class SocketHandler(logging.Handler): try: self.sock = self.makeSocket() self.retryTime = None # next time, no delay before trying - except: + except socket.error: #Creation failed, so set the retry time and return. if self.retryTime is None: self.retryPeriod = self.retryStart @@ -734,7 +734,7 @@ class SMTPHandler(logging.Handler): import smtplib try: from email.Utils import formatdate - except: + except ImportError: formatdate = self.date_time port = self.mailport if not port: