[Python-checkins] cpython (merge 3.2 -> 3.2): Merge

antoine.pitrou python-checkins at python.org
Sat May 7 19:48:56 CEST 2011


http://hg.python.org/cpython/rev/a1158371956e
changeset:   69927:a1158371956e
branch:      3.2
parent:      69920:de411da2dbdb
parent:      69924:209744660b92
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Sat May 07 19:47:24 2011 +0200
summary:
  Merge

files:
  Lib/smtplib.py           |  6 ++++--
  Lib/test/test_smtpnet.py |  7 +++++++
  Misc/ACKS                |  1 +
  Misc/NEWS                |  3 +++
  4 files changed, 15 insertions(+), 2 deletions(-)


diff --git a/Lib/smtplib.py b/Lib/smtplib.py
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -231,6 +231,7 @@
     ehlo_msg = "ehlo"
     ehlo_resp = None
     does_esmtp = 0
+    default_port = SMTP_PORT
 
     def __init__(self, host='', port=0, local_hostname=None,
                  timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
@@ -246,7 +247,6 @@
         """
         self.timeout = timeout
         self.esmtp_features = {}
-        self.default_port = SMTP_PORT
         if host:
             (code, msg) = self.connect(host, port)
             if code != 220:
@@ -804,13 +804,15 @@
         are also optional - they can contain a PEM formatted private key and
         certificate chain file for the SSL connection.
         """
+
+        default_port = SMTP_SSL_PORT
+
         def __init__(self, host='', port=0, local_hostname=None,
                      keyfile=None, certfile=None,
                      timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
             self.keyfile = keyfile
             self.certfile = certfile
             SMTP.__init__(self, host, port, local_hostname, timeout)
-            self.default_port = SMTP_SSL_PORT
 
         def _get_socket(self, host, port, timeout):
             if self.debuglevel > 0:
diff --git a/Lib/test/test_smtpnet.py b/Lib/test/test_smtpnet.py
--- a/Lib/test/test_smtpnet.py
+++ b/Lib/test/test_smtpnet.py
@@ -17,6 +17,13 @@
         server.ehlo()
         server.quit()
 
+    def test_connect_default_port(self):
+        support.get_attribute(smtplib, 'SMTP_SSL')
+        with support.transient_internet(self.testServer):
+            server = smtplib.SMTP_SSL(self.testServer)
+        server.ehlo()
+        server.quit()
+
 def test_main():
     support.run_unittest(SmtpSSLTest)
 
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -366,6 +366,7 @@
 Lance Finn Helsten
 Jonathan Hendry
 James Henstridge
+Kasun Herath
 Chris Herborth
 Ivan Herman
 Jürgen Hermann
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -83,6 +83,9 @@
 Library
 -------
 
+- Issue #11927: SMTP_SSL now uses port 465 by default as documented.  Patch
+  by Kasun Herath.
+
 - Issue #12002: ftplib's abort() method raises TypeError.
 
 - Issue 11999: fixed sporadic sync failure mailbox.Maildir due to its trying to

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list