diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2014-06-03 14:24:54 (GMT) |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2014-06-03 14:24:54 (GMT) |
commit | 4ce118e99a21639ceed744ced7d35d8f0ec5f0c2 (patch) | |
tree | fa6f278736007b7312df1de36e8ea760e47470a2 /Lib/smtplib.py | |
parent | 8dc3df1b6062075684b3de957cf8d4f9f5bc84de (diff) | |
download | cpython-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-x | Lib/smtplib.py | 1 |
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] |