Issue #20059: urllib.parse raises ValueError on all invalid ports.

Patch by Martin Panter.
This commit is contained in:
Robert Collins 2015-08-10 09:53:30 +12:00
parent 846a1487cb
commit dfa95c9a8f
5 changed files with 39 additions and 26 deletions

View file

@ -156,9 +156,8 @@ class _NetlocResultMixinBase(object):
port = self._hostinfo[1]
if port is not None:
port = int(port, 10)
# Return None on an illegal port
if not ( 0 <= port <= 65535):
return None
raise ValueError("Port out of range 0-65535")
return port