[Python-checkins] cpython (3.4): Fix issue #21641: Close the socket before raising the SMTPResponseException.

senthil.kumaran python-checkins at python.org
Tue Jun 3 16:25:49 CEST 2014


http://hg.python.org/cpython/rev/d5c76646168d
changeset:   90993:d5c76646168d
branch:      3.4
parent:      90991:e6dce5611dae
user:        Senthil Kumaran <senthil at uthcode.com>
date:        Tue Jun 03 07:24:54 2014 -0700
summary:
  Fix issue #21641: Close the socket before raising the SMTPResponseException. Fixes the ResourceWarning in the test run.

Patch by Claudiu.Popa.

files:
  Lib/smtplib.py |  1 +
  1 files changed, 1 insertions(+), 0 deletions(-)


diff --git a/Lib/smtplib.py b/Lib/smtplib.py
--- 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]

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list