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.

classification
Title: `port` and `host` are confused in `_get_socket
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: cool-RR, python-dev, r.david.murray, terry.reedy, vterron
Priority: low Keywords: patch

Created on 2011-10-12 22:51 by cool-RR, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue13163.patch vterron, 2011-10-19 08:48 Fix for SMTP._get_socket review
Messages (10)
msg145442 - (view) Author: Ram Rachum (cool-RR) * Date: 2011-10-12 22:51
Look here:

http://hg.python.org/cpython/file/3313ce92cef7/Lib/smtplib.py#l279

`port` and `host` are confused.

I saw this is fixed on 3.2; possibly it should be fixed in the next 2.7 micro release too.
msg145479 - (view) Author: Víctor Terrón (vterron) * Date: 2011-10-13 19:11
Added a ridiculously simple patch, in case it is going to get fixed in 2.7.
msg145481 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-10-13 19:32
Well, your patch is a little *too* simple: it doesn't change the function prototype to match :)

This is a cosmetic issue rather than a bug, but it would still be nice to fix it.  Or maybe a documentation issue in the sense that Python code is (usually) self documenting :)
msg145482 - (view) Author: Ram Rachum (cool-RR) * Date: 2011-10-13 19:34
The reason this bug bothered me is because I was debugging a Django app, and in the stacktrace's local variables I suddenly saw that `host` was `25`, which seemed like a bug to me and wasted me 5 minutes. So it's not a critical bug but it wasted my time.
msg145484 - (view) Author: Víctor Terrón (vterron) * Date: 2011-10-13 19:46
It was strange it was *that* easy. My newbie apologies, David. Let me take a look at it -- hopefully it will be an adequate first task for a newcomer.
msg145512 - (view) Author: Víctor Terrón (vterron) * Date: 2011-10-14 12:23
Patch updated. It is now a two-line patch. How impressive :-)
Anyway, I have verified that the entire test suite runs without failure.
Should Misc/NEWS be updated for such a trivial modification?
msg145575 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-10-15 00:28
My understanding is that an undocumented internal methods has two bugs that cancel, so that correct calls work correctly -- but tracebacks do not. I think this should be fixed, especially given a working patch.

Optionally add a doc string, which is how we usually (often, when someone gets around to it) do doc internal functions. Perhaps include the current comment (which I do not understand).

If you, Victor, are not in the contributors file, add a one-line patch for that.

Optionally (but it would certainly be good learning practice) add NEWS item. Something like
"Issue 13163: fix smtplib.SMTP._get_socket so that tracebacks correctly identity host and port arguments.
However, this is best done when someone is ready to apply and push the patch, as frequent changes to NEWS make patches stale.
msg145896 - (view) Author: Víctor Terrón (vterron) * Date: 2011-10-19 08:48
I have added a docstring to _get_socket.

My proposed news entry is almost exactly what you suggested (I have just replaced 'identity' with 'identify'): 
"Issue #13163: Fix smtplib.SMTP._get_socket so that tracebacks correctly identify host and port arguments."
msg185843 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-04-02 16:15
New changeset 5d99042bd40f by R David Murray in branch '2.7':
#13163: fix names of _get_socket args
http://hg.python.org/cpython/rev/5d99042bd40f
msg185844 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-04-02 16:16
Thanks Victor.  I decided not to put in the doc string because Python3 doesn't have one.
History
Date User Action Args
2022-04-11 14:57:22adminsetgithub: 57372
2013-04-02 16:16:27r.david.murraysetstatus: open -> closed
resolution: fixed
messages: + msg185844

stage: resolved
2013-04-02 16:15:43python-devsetnosy: + python-dev
messages: + msg185843
2011-10-19 08:49:43vterronsetfiles: - smtplib.py.diff
2011-10-19 08:48:52vterronsetfiles: + issue13163.patch

messages: + msg145896
2011-10-15 00:28:56terry.reedysettype: behavior

messages: + msg145575
nosy: + terry.reedy
2011-10-14 12:23:53vterronsetfiles: + smtplib.py.diff

messages: + msg145512
2011-10-14 12:11:44vterronsetfiles: - smtplib.py.diff
2011-10-13 19:46:33vterronsetmessages: + msg145484
2011-10-13 19:34:12cool-RRsetmessages: + msg145482
2011-10-13 19:32:00r.david.murraysetpriority: normal -> low

messages: + msg145481
2011-10-13 19:11:20vterronsetfiles: + smtplib.py.diff

nosy: + vterron
messages: + msg145479

keywords: + patch
2011-10-13 15:29:16pitrousetnosy: + r.david.murray
2011-10-12 22:51:21cool-RRcreate