Issue 13163: port and host are confused in `_get_socket (original) (raw)

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:22 admin set github: 57372
2013-04-02 16:16:27 r.david.murray set status: open -> closedresolution: fixedmessages: + stage: resolved
2013-04-02 16:15:43 python-dev set nosy: + python-devmessages: +
2011-10-19 08:49:43 vterron set files: - smtplib.py.diff
2011-10-19 08:48:52 vterron set files: + issue13163.patchmessages: +
2011-10-15 00:28:56 terry.reedy set type: behaviormessages: + nosy: + terry.reedy
2011-10-14 12:23:53 vterron set files: + smtplib.py.diffmessages: +
2011-10-14 12:11:44 vterron set files: - smtplib.py.diff
2011-10-13 19:46:33 vterron set messages: +
2011-10-13 19:34:12 cool-RR set messages: +
2011-10-13 19:32:00 r.david.murray set priority: normal -> lowmessages: +
2011-10-13 19:11:20 vterron set files: + smtplib.py.diffnosy: + vterronmessages: + keywords: + patch
2011-10-13 15:29:16 pitrou set nosy: + r.david.murray
2011-10-12 22:51:21 cool-RR create