diff options
Diffstat (limited to 'Lib/urlparse.py')
-rw-r--r-- | Lib/urlparse.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/urlparse.py b/Lib/urlparse.py index 4ce982e..4cd3d67 100644 --- a/Lib/urlparse.py +++ b/Lib/urlparse.py @@ -109,10 +109,11 @@ class ResultMixin(object): netloc = self.netloc.split('@')[-1].split(']')[-1] if ':' in netloc: port = netloc.split(':')[1] - port = int(port, 10) - # verify legal port - if (0 <= port <= 65535): - return port + if port: + port = int(port, 10) + # verify legal port + if (0 <= port <= 65535): + return port return None from collections import namedtuple |