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.

Author Kurt.Rose
Recipients Kurt.Rose, r.david.murray
Date 2015-05-13.18:01:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1431540102.66.0.456403843618.issue24169@psf.upfronthosting.co.za>
In-reply-to
Content
I think this may in fact be a bug.  There are other places in the socket module where port is checked, create_connection() just seems to have been missed.

create_connection() and socket.connect() have different behavior:

>>> socket.create_connection( ('google.com', 0x10000 + 80) )
<socket._socketobject object at 0x028B3F48>
>>> socket.socket().connect( ('google.com', 0x10000 + 80) )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
OverflowError: getsockaddrarg: port must be 0-65535.


https://hg.python.org/cpython/file/712f246da49b/Modules/socketmodule.c#l1395

        if (port < 0 || port > 0xffff) {
            PyErr_SetString(
                PyExc_OverflowError,
                "getsockaddrarg: port must be 0-65535.");
            return 0;
        }
History
Date User Action Args
2015-05-13 18:01:42Kurt.Rosesetrecipients: + Kurt.Rose, r.david.murray
2015-05-13 18:01:42Kurt.Rosesetmessageid: <1431540102.66.0.456403843618.issue24169@psf.upfronthosting.co.za>
2015-05-13 18:01:42Kurt.Roselinkissue24169 messages
2015-05-13 18:01:42Kurt.Rosecreate