Kaydet (Commit) 9e98cd03 authored tarafından Joel Hillacre's avatar Joel Hillacre Kaydeden (comit) Xiang Zhang

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

üst 1abcf670
...@@ -250,6 +250,7 @@ class SMTP: ...@@ -250,6 +250,7 @@ class SMTP:
if host: if host:
(code, msg) = self.connect(host, port) (code, msg) = self.connect(host, port)
if code != 220: if code != 220:
self.close()
raise SMTPConnectError(code, msg) raise SMTPConnectError(code, msg)
if local_hostname is not None: if local_hostname is not None:
self.local_hostname = local_hostname self.local_hostname = local_hostname
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment