]> granicus.if.org Git - python/commitdiff
Fix issue #21641: Close the socket before raising the SMTPResponseException. Fixes...
authorSenthil Kumaran <senthil@uthcode.com>
Tue, 3 Jun 2014 14:24:54 +0000 (07:24 -0700)
committerSenthil Kumaran <senthil@uthcode.com>
Tue, 3 Jun 2014 14:24:54 +0000 (07:24 -0700)
Patch by Claudiu.Popa.

Lib/smtplib.py

index ec43666df3db2fd0a268180a49167a9ed4ad0a07..759b77e47fa3e6d2abe13c8407ec5e877e2b9373 100755 (executable)
@@ -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]