Skip to content

Commit f6f61ff

Browse files
committed
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.
2 parents 6120ab8 + 4ce118e commit f6f61ff

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

Lib/smtplib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ def getreply(self):
377377
if self.debuglevel > 0:
378378
print('reply:', repr(line), file=stderr)
379379
if len(line) > _MAXLINE:
380+
self.close()
380381
raise SMTPResponseException(500, "Line too long.")
381382
resp.append(line[4:].strip(b' \t\r\n'))
382383
code = line[:3]

0 commit comments

Comments
 (0)