Issue 7702: Wrong order of parameters of _get_socket in SMTP class in smtplib.py (original) (raw)

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