[New-bugs-announce] [issue7702] Wrong order of parameters of _get_socket in SMTP class in smtplib.py
alito
report at bugs.python.org
Thu Jan 14 14:15:14 CET 2010
New submission from alito <alito at 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 <report at bugs.python.org>
<http://bugs.python.org/issue7702>
_______________________________________
More information about the New-bugs-announce
mailing list