[Python-checkins] cpython (merge 3.2 -> default): Provide a better diagnosis on socket errors
antoine.pitrou
python-checkins at python.org
Sun Aug 28 01:26:54 CEST 2011
http://hg.python.org/cpython/rev/98fecf6e1972
changeset: 72107:98fecf6e1972
parent: 72104:1dfced04adbc
parent: 72106:87b9399e83c7
user: Antoine Pitrou <solipsis at pitrou.net>
date: Sun Aug 28 01:22:22 2011 +0200
summary:
Provide a better diagnosis on socket errors
files:
Lib/smtplib.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -363,8 +363,10 @@
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 not line:
self.close()
raise SMTPServerDisconnected("Connection unexpectedly closed")
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list