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:
parent
8dc3df1b60
commit
4ce118e99a
|
@ -377,6 +377,7 @@ class SMTP:
|
||||||
if self.debuglevel > 0:
|
if self.debuglevel > 0:
|
||||||
print('reply:', repr(line), file=stderr)
|
print('reply:', repr(line), file=stderr)
|
||||||
if len(line) > _MAXLINE:
|
if len(line) > _MAXLINE:
|
||||||
|
self.close()
|
||||||
raise SMTPResponseException(500, "Line too long.")
|
raise SMTPResponseException(500, "Line too long.")
|
||||||
resp.append(line[4:].strip(b' \t\r\n'))
|
resp.append(line[4:].strip(b' \t\r\n'))
|
||||||
code = line[:3]
|
code = line[:3]
|
||||||
|
|
Loading…
Reference in New Issue