➜

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.

作者 chad.birch
收信人 chad.birch
日期 2013-12-23.23:51:50
SpamBayes Score -1.0
Marked as misclassified 是
Message-id <1387842710.57.0.78188368243.issue20059@psf.upfronthosting.co.za>
In-reply-to
内容
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).
历史
日期 用户 动作 参数
2013-12-23 23:51:50chad.birch修改recipients: + chad.birch
2013-12-23 23:51:50chad.birch修改messageid: <1387842710.57.0.78188368243.issue20059@psf.upfronthosting.co.za>
2013-12-23 23:51:50chad.birch链接issue20059 messages
2013-12-23 23:51:50chad.birch创建