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.
This commit is contained in:
Senthil Kumaran 2014-06-03 07:25:40 -07:00
commit f6f61ff339
1 changed files with 1 additions and 0 deletions

View File

@ -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]