]> granicus.if.org Git - python/commitdiff
Issue 4929: Handle socket errors when receiving
authorKristján Valur Jónsson <kristjan@ccpgames.com>
Thu, 15 Jan 2009 17:20:21 +0000 (17:20 +0000)
committerKristján Valur Jónsson <kristjan@ccpgames.com>
Thu, 15 Jan 2009 17:20:21 +0000 (17:20 +0000)
Lib/smtplib.py

index afa38bc7f43986f4d08c6a773037f0274c49bb15..69d7f71d96ab1f1a11865c7bac3b7d6057b09b61 100755 (executable)
@@ -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")