mirror of https://github.com/python/cpython.git
bpo-30394: Fix a socket leak in smtplib.SMTP.__init__() (#1700)
This commit is contained in:
parent
1abcf6700b
commit
9e98cd0383
|
@ -250,6 +250,7 @@ def __init__(self, host='', port=0, local_hostname=None,
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue