diff --git a/Lib/smtplib.py b/Lib/smtplib.py index f9576367f09..07582f673bc 100755 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -352,8 +352,10 @@ class SMTP: while 1: try: line = self.file.readline() - except socket.error: - line = '' + except socket.error as e: + self.close() + raise SMTPServerDisconnected("Connection unexpectedly closed: " + + str(e)) if line == '': self.close() raise SMTPServerDisconnected("Connection unexpectedly closed")