This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author alito
Recipients alito
Date 2010-01-14.13:15:11
SpamBayes Score 3.2769804e-10
Marked as misclassified No
Message-id <1263474914.94.0.504255550545.issue7702@psf.upfronthosting.co.za>
In-reply-to
Content
Trivial change with (almost) no effect.

The method signature for _get_socket in the SMTP class in stmplib.py is 

def _get_socket(self, port, host, timeout)

It should be:

def _get_socket(self, host, port, timeout)

Evidence:
1) It calls socket.create_connection((port, host), ....) but socket.create_connection expects (host, port).
2) The only time it is called in smtplib.py, it is called as self._get_socket(host, port, self.timeout)
3) In the derived class SMTP_SSL, it is defined as (self, host, port, timeout)


I wrote _almost_ no effect because the debugging output from it will now be in the right order (host, port).

Patch wrt python svn trunk follows:

Index: smtplib.py
===================================================================
--- smtplib.py	(revision 77465)
+++ smtplib.py	(working copy)
@@ -266,11 +266,11 @@
         """
         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.
History
Date User Action Args
2010-01-14 13:15:15alitosetrecipients: + alito
2010-01-14 13:15:14alitosetmessageid: <1263474914.94.0.504255550545.issue7702@psf.upfronthosting.co.za>
2010-01-14 13:15:12alitolinkissue7702 messages
2010-01-14 13:15:12alitocreate