summaryrefslogtreecommitdiffstats
path: root/Lib/smtplib.py
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2014-06-03 14:24:54 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2014-06-03 14:24:54 (GMT)
commit4ce118e99a21639ceed744ced7d35d8f0ec5f0c2 (patch)
treefa6f278736007b7312df1de36e8ea760e47470a2 /Lib/smtplib.py
parent8dc3df1b6062075684b3de957cf8d4f9f5bc84de (diff)
downloadcpython-4ce118e99a21639ceed744ced7d35d8f0ec5f0c2.zip
cpython-4ce118e99a21639ceed744ced7d35d8f0ec5f0c2.tar.gz
cpython-4ce118e99a21639ceed744ced7d35d8f0ec5f0c2.tar.bz2
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/smtplib.py')
-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]