]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Cosmetic smtplib changes (GH-8718)
authorVille Skyttä <ville.skytta@iki.fi>
Sat, 23 May 2020 00:50:58 +0000 (03:50 +0300)
committerGitHub <noreply@github.com>
Sat, 23 May 2020 00:50:58 +0000 (17:50 -0700)
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
Doc/library/smtplib.rst
Lib/smtplib.py

index a88e358eae5fdece69f68c5da6bc5289f158128c..b3cc60357f554ac041a6dfca9738cd7ade94f239 100644 (file)
@@ -279,9 +279,10 @@ An :class:`SMTP` instance has the following methods:
    response for ESMTP option and store them for use by :meth:`has_extn`.
    Also sets several informational attributes: the message returned by
    the server is stored as the :attr:`ehlo_resp` attribute, :attr:`does_esmtp`
-   is set to true or false depending on whether the server supports ESMTP, and
-   :attr:`esmtp_features` will be a dictionary containing the names of the
-   SMTP service extensions this server supports, and their parameters (if any).
+   is set to ``True`` or ``False`` depending on whether the server supports
+   ESMTP, and :attr:`esmtp_features` will be a dictionary containing the names
+   of the SMTP service extensions this server supports, and their parameters
+   (if any).
 
    Unless you wish to use :meth:`has_extn` before sending mail, it should not be
    necessary to call this method explicitly.  It will be implicitly called by
index 7808ba01cba887f6359a8af488376d8abd41a046..e2dbbbcf2e6d1640af4e87260af24d5b2d8b69dc 100755 (executable)
@@ -222,7 +222,7 @@ class SMTP:
     helo_resp = None
     ehlo_msg = "ehlo"
     ehlo_resp = None
-    does_esmtp = 0
+    does_esmtp = False
     default_port = SMTP_PORT
 
     def __init__(self, host='', port=0, local_hostname=None,
@@ -452,7 +452,7 @@ class SMTP:
         self.ehlo_resp = msg
         if code != 250:
             return (code, msg)
-        self.does_esmtp = 1
+        self.does_esmtp = True
         #parse the ehlo response -ddm
         assert isinstance(self.ehlo_resp, bytes), repr(self.ehlo_resp)
         resp = self.ehlo_resp.decode("latin-1").split('\n')
@@ -781,7 +781,7 @@ class SMTP:
             self.helo_resp = None
             self.ehlo_resp = None
             self.esmtp_features = {}
-            self.does_esmtp = 0
+            self.does_esmtp = False
         else:
             # RFC 3207:
             # 501 Syntax error (no parameters allowed)