commit | 4ce118e99a21639ceed744ced7d35d8f0ec5f0c2 | [log] [tgz] |
---|---|---|
author | Senthil Kumaran <senthil@uthcode.com> | Tue Jun 03 07:24:54 2014 -0700 |
committer | Senthil Kumaran <senthil@uthcode.com> | Tue Jun 03 07:24:54 2014 -0700 |
tree | fa6f278736007b7312df1de36e8ea760e47470a2 | |
parent | 8dc3df1b6062075684b3de957cf8d4f9f5bc84de [diff] |
Fix issue #21641: Close the socket before raising the SMTPResponseException. Fixes the ResourceWarning in the test run. Patch by Claudiu.Popa.
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 @@ 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]