]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#13163: fix names of _get_socket args
authorR David Murray <rdmurray@bitdance.com>
Tue, 2 Apr 2013 16:15:07 +0000 (12:15 -0400)
committerR David Murray <rdmurray@bitdance.com>
Tue, 2 Apr 2013 16:15:07 +0000 (12:15 -0400)
This was already done in Python3, but having it wrong leads to
incorrect debug output, so it seems worth fixing in 2.7 as well.

Patch by Victor Terrón.

Doc/library/email.mime.rst
Lib/smtplib.py
Misc/ACKS
Misc/NEWS

index 5fa82d022de61f5b8f2e9357350fc41a573b706b..957504da44d4516e9f97bf5050705f327688a5d6 100644 (file)
@@ -199,3 +199,12 @@ Here are the classes:
       Transfer Encoding now happens implicitly based on the *_charset*
       argument.
 
+   Unless the ``_charset`` parameter is explicitly set to ``None``, the
+   MIMEText object created will have both a :mailheader:`Content-Type` header
+   with a ``charset`` parameter, and a :mailheader:`Content-Transfer-Endcoding`
+   header.  This means that a subsequent ``set_payload`` call will not result
+   in an encoded payload, even if a charset is passed in the ``set_payload``
+   command.  You can "reset" this behavior by deleting the
+   ``Content-Transfer-Encoding`` header, after which a ``set_payload`` call
+   will automatically encode the new payload (and add a new
+   :mailheader:`Content-Transfer-Encoding` header).
index 099e54a4fa1e3ccbd43a235a502e4fef7f5b2683..9e8bc72379f2dc80fed9b94e6b7dbded4ef5259d 100755 (executable)
@@ -276,12 +276,12 @@ class SMTP:
         """
         self.debuglevel = debuglevel
 
-    def _get_socket(self, port, host, timeout):
+    def _get_socket(self, host, port, timeout):
         # This makes it simpler for SMTP_SSL to use the SMTP connect code
         # and just alter the socket connection bit.
         if self.debuglevel > 0:
             print>>stderr, 'connect:', (host, port)
-        return socket.create_connection((port, host), timeout)
+        return socket.create_connection((host, port), timeout)
 
     def connect(self, host='localhost', port=0):
         """Connect to a host on a given port.
index 593ba4d23e23e1348a899e7b82ed0d4e2893d4a8..2d6bd07892f9ff3143e0a442ca4d16d26582269a 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -992,6 +992,7 @@ Monty Taylor
 Amy Taylor
 Anatoly Techtonik
 Mikhail Terekhov
+Victor Terrón
 Richard M. Tew
 Tobias Thelen
 Lowe Thiderman
index 70dd410c24360a1c82a5590d7abc3d4593239fe8..ab655ebe0915f2a8e023e4fe17fb5b57824455a3 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #13163: Rename operands in smtplib.SMTP._get_socket to correct names;
+  fixes otherwise misleading output in tracebacks and when when debug is on.
+
 - Issue #6698: IDLE now opens just an editor window when configured to do so.
 
 - Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer