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 chad.birch
Recipients chad.birch
Date 2013-12-23.23:51:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1387842710.57.0.78188368243.issue20059@psf.upfronthosting.co.za>
In-reply-to
Content
I'm not sure if this is something that needs adjustment, but it seems somewhat inconsistent to me.

After using urlparse() on various urls with invalid port values, trying to access .port on the result will raise a ValueError. This case includes urls such as:

"http://www.example.com:asdf"

"http://www.example.com:1.5"

"http://www.example.com:"

However, as of May 24 2012 (http://hg.python.org/cpython/diff/d769e64aed79/Lib/urllib/parse.py), if the invalid port value is an integer, accessing .port will result in None. So this includes urls such as:

"http://www.example.com:66000"

"http://www.example.com:-1"

Should these two cases be made consistent, so that either .port is always None or always results in a ValueError if the port section of the url is invalid? I'd be happy to write a patch for it if it's wanted, but I thought I'd check first (and see which of the two options would be correct, if so).
History
Date User Action Args
2013-12-23 23:51:50chad.birchsetrecipients: + chad.birch
2013-12-23 23:51:50chad.birchsetmessageid: <1387842710.57.0.78188368243.issue20059@psf.upfronthosting.co.za>
2013-12-23 23:51:50chad.birchlinkissue20059 messages
2013-12-23 23:51:50chad.birchcreate