summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2014-06-03 14:25:40 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2014-06-03 14:25:40 (GMT)
commitf6f61ff339c80dd164668c9689e0b56c5dfc5417 (patch)
treebe100ba1aa1810f0b72867e0cdf444ddd69e6d6e /Lib
parent6120ab8150bec7131f8bb2713f3bcba8adad01e5 (diff)
parent4ce118e99a21639ceed744ced7d35d8f0ec5f0c2 (diff)
downloadcpython-f6f61ff339c80dd164668c9689e0b56c5dfc5417.zip
cpython-f6f61ff339c80dd164668c9689e0b56c5dfc5417.tar.gz
cpython-f6f61ff339c80dd164668c9689e0b56c5dfc5417.tar.bz2
merge from 3.4
Fix issue #21641: Close the socket before raising the SMTPResponseException. Fixes the ResourceWarning in the test run. Patch by Claudiu.Popa.
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/smtplib.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
index ec43666..759b77e 100755
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -377,6 +377,7 @@ class SMTP:
if self.debuglevel > 0:
print('reply:', repr(line), file=stderr)
if len(line) > _MAXLINE:
+ self.close()
raise SMTPResponseException(500, "Line too long.")
resp.append(line[4:].strip(b' \t\r\n'))
code = line[:3]