bpo-30394: Fix a socket leak in smtplib.SMTP.__init__() (#1700) (#1788)

This commit is contained in:
Stéphane Wirtel 2017-05-24 20:24:27 +02:00 committed by Xiang Zhang
parent 9395ca40f2
commit 779e7c933e
1 changed files with 1 additions and 0 deletions

View File

@ -255,6 +255,7 @@ class SMTP:
if host:
(code, msg) = self.connect(host, port)
if code != 220:
self.close()
raise SMTPConnectError(code, msg)
if local_hostname is not None:
self.local_hostname = local_hostname