New submission from alito <al...@organicrobot.com>: 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. ---------- components: Library (Lib) messages: 97761 nosy: alito severity: normal status: open title: Wrong order of parameters of _get_socket in SMTP class in smtplib.py versions: Python 2.6, Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7702> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com