From dfa95c9a8f2772d1e8e54aa5aa14c91d4971964f Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Mon, 10 Aug 2015 09:53:30 +1200 Subject: Issue #20059: urllib.parse raises ValueError on all invalid ports. Patch by Martin Panter. --- Lib/urllib/parse.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Lib/urllib/parse.py') diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py index 01c9e587fb..5e2155ccaf 100644 --- a/Lib/urllib/parse.py +++ b/Lib/urllib/parse.py @@ -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 -- cgit v1.2.1