Kaydet (Commit) c3454f0e authored tarafından Stéphane Wirtel's avatar Stéphane Wirtel Kaydeden (comit) Xiang Zhang

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

üst 9bcf81da
...@@ -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