From: Kristján Valur Jónsson Date: Thu, 15 Jan 2009 17:20:21 +0000 (+0000) Subject: Issue 4929: Handle socket errors when receiving X-Git-Tag: v2.7a1~2284 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51a035e383978ee0a529a35a7ecbde41c45ab99d;p=thirdparty%2FPython%2Fcpython.git Issue 4929: Handle socket errors when receiving --- diff --git a/Lib/smtplib.py b/Lib/smtplib.py index afa38bc7f439..69d7f71d96ab 100755 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -334,7 +334,10 @@ class SMTP: if self.file is None: self.file = self.sock.makefile('rb') while 1: - line = self.file.readline() + try: + line = self.file.readline() + except socket.error: + line = '' if line == '': self.close() raise SMTPServerDisconnected("Connection unexpectedly closed")