[Python-checkins] r68618 - python/trunk/Lib/smtplib.py

kristjan.jonsson python-checkins at python.org
Thu Jan 15 18:20:21 CET 2009


Author: kristjan.jonsson
Date: Thu Jan 15 18:20:21 2009
New Revision: 68618

Log:
Issue 4929:  Handle socket errors when receiving

Modified:
   python/trunk/Lib/smtplib.py

Modified: python/trunk/Lib/smtplib.py
==============================================================================
--- python/trunk/Lib/smtplib.py	(original)
+++ python/trunk/Lib/smtplib.py	Thu Jan 15 18:20:21 2009
@@ -334,7 +334,10 @@
         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")


More information about the Python-checkins mailing list