Skip to content

Commit da51ba4

Browse files
authored
Cosmetic smtplib changes (GH-8718)
Some cosmetic smtplib changes here. Let me know if you'd like a bpo/news entry or splitting this PR into two. Automerge-Triggered-By: @maxking
1 parent 6fad3e6 commit da51ba4

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Doc/library/smtplib.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,10 @@ An :class:`SMTP` instance has the following methods:
279279
response for ESMTP option and store them for use by :meth:`has_extn`.
280280
Also sets several informational attributes: the message returned by
281281
the server is stored as the :attr:`ehlo_resp` attribute, :attr:`does_esmtp`
282-
is set to true or false depending on whether the server supports ESMTP, and
283-
:attr:`esmtp_features` will be a dictionary containing the names of the
284-
SMTP service extensions this server supports, and their parameters (if any).
282+
is set to ``True`` or ``False`` depending on whether the server supports
283+
ESMTP, and :attr:`esmtp_features` will be a dictionary containing the names
284+
of the SMTP service extensions this server supports, and their parameters
285+
(if any).
285286

286287
Unless you wish to use :meth:`has_extn` before sending mail, it should not be
287288
necessary to call this method explicitly. It will be implicitly called by

Lib/smtplib.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ class SMTP:
222222
helo_resp = None
223223
ehlo_msg = "ehlo"
224224
ehlo_resp = None
225-
does_esmtp = 0
225+
does_esmtp = False
226226
default_port = SMTP_PORT
227227

228228
def __init__(self, host='', port=0, local_hostname=None,
@@ -452,7 +452,7 @@ def ehlo(self, name=''):
452452
self.ehlo_resp = msg
453453
if code != 250:
454454
return (code, msg)
455-
self.does_esmtp = 1
455+
self.does_esmtp = True
456456
#parse the ehlo response -ddm
457457
assert isinstance(self.ehlo_resp, bytes), repr(self.ehlo_resp)
458458
resp = self.ehlo_resp.decode("latin-1").split('\n')
@@ -781,7 +781,7 @@ def starttls(self, keyfile=None, certfile=None, context=None):
781781
self.helo_resp = None
782782
self.ehlo_resp = None
783783
self.esmtp_features = {}
784-
self.does_esmtp = 0
784+
self.does_esmtp = False
785785
else:
786786
# RFC 3207:
787787
# 501 Syntax error (no parameters allowed)

0 commit comments

Comments
 (0)