Changes by Robert Collins robe...@robertcollins.net:
--
resolution: - fixed
stage: commit review - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20059
___
Roundup Robot added the comment:
New changeset 7c78279afc30 by Robert Collins in branch 'default':
Issue #20059: urllib.parse raises ValueError on all invalid ports.
https://hg.python.org/cpython/rev/7c78279afc30
--
nosy: +python-dev
___
Python
Robert Collins added the comment:
So, I think this is worth applying. The discussion around :ipp etc is
irrelevant here: this patch changes large or negative ints to be a valueerror,
as non-ints are.
The only question is where. I think this is in the category of 'will only break
buggy
R. David Murray added the comment:
Because it raises an error where none was raised before, I'd only apply this to
3.6. This is especially true since this issue is not a *bug* report, but a
shouldn't this be more consistent report. That is, there's no great weight
(the OP wasn't even sure
Robert Collins added the comment:
ok, 3.6 only.
--
versions: +Python 3.6 -Python 2.7, Python 3.4, Python 3.5
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20059
___
Martin Panter added the comment:
If we take the 3.6-only path, does that warrant adding “Version changed”
notices, and/or a What’s New entry?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20059
Martin Panter added the comment:
Added versioning notices in port-ValueError.v3.patch.
--
Added file: http://bugs.python.org/file40061/port-ValueError.v3.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20059
R. David Murray added the comment:
Hmm. Good question. I think it probably does, because it means getting an
exception where one did not previously happen.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20059
Martin Panter added the comment:
Patch v2 just changes a test to use “with self.assertRaises()”.
The behaviour of urlparse() succeeding and then result.port failing is indeed
odd and surprising. Hopefully documenting this behaviour will help with the
“surprising” aspect. But changing it would
Demian Brecht added the comment:
It is surprising that urlsplit() does not raise any exception
I have a bit of a TL;DR in #20271, trying to capture what the responsibilities
of split and parse methods in urllib are and what they should be if consistency
is something that we're after.
Berker Peksag added the comment:
I think it is worth to be applied to maintained releases.
I'd commit this only to the default branch. Changing the return value from None
to an exception after three 3.4 bugfix releases(3.4.1, 3.4.2 and 3.4.3 -- also
since 3.4.3 was released in Feb 2015,
Serhiy Storchaka added the comment:
LGTM and I think it is worth to be applied to maintained releases.
--
nosy: +orsenthil
stage: - commit review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20059
Martin Panter added the comment:
See also Issue 20271, which has a proposed patch with more strict urlsplit()
etc behaviour before even returning a SplitResult object.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20059
Changes by Berker Peksag berker.pek...@gmail.com:
--
nosy: +berker.peksag
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20059
___
___
Martin Panter added the comment:
Mapping out-of-range ports to None was added in Issue 14036, though I don’t
understand why that approach was taken instead of raising ValueError. Here is a
patch to raise ValueError for out-of-range integer values instead.
--
keywords: +patch
Added
Martin Panter added the comment:
I would go for raising ValueError for port numbers out of range. The value of
None was already defined to mean that no port is included in the URL.
Also, the ValueError exception should be documented. It is surprising that
urlsplit() does not raise any
Changes by Serhiy Storchaka storch...@gmail.com:
--
nosy: +serhiy.storchaka
versions: +Python 2.7, Python 3.4, Python 3.5
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20059
___
Changes by Chris Rebert pyb...@rebertia.com:
--
nosy: +cvrebert
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20059
___
___
Python-bugs-list
Changes by Martin Panter vadmium...@gmail.com:
--
nosy: +vadmium
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20059
___
___
Python-bugs-list
New submission from Chad Birch:
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:
20 matches
Mail list logo