cpython: 7c78279afc30 (original) (raw)

Mercurial > cpython

changeset 97346:7c78279afc30

Issue #20059: urllib.parse raises ValueError on all invalid ports. Patch by Martin Panter. [#20059]

Robert Collins rbtcollins@hp.com
date Mon, 10 Aug 2015 09:53:30 +1200
parents a16c6456f34b
children f304ba9425a3
files Doc/library/urllib.parse.rst Doc/whatsnew/3.6.rst Lib/test/test_urlparse.py Lib/urllib/parse.py Misc/NEWS
diffstat 5 files changed, 39 insertions(+), 26 deletions(-)[+] [-] Doc/library/urllib.parse.rst 18 Doc/whatsnew/3.6.rst 5 Lib/test/test_urlparse.py 36 Lib/urllib/parse.py 3 Misc/NEWS 3

line wrap: on

line diff

--- a/Doc/library/urllib.parse.rst +++ b/Doc/library/urllib.parse.rst @@ -115,8 +115,9 @@ or on combining URL components into a UR | | | if present | | +------------------+-------+--------------------------+----------------------+

+ .. function:: parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace') @@ -228,8 +233,13 @@ or on combining URL components into a UR | | | if present | | +------------------+-------+-------------------------+----------------------+

.. function:: urlunsplit(parts)

--- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -162,7 +162,10 @@ that may require changes to your code. Changes in the Python API ------------------------- -* None yet. +* Reading the :attr:~urllib.parse.SplitResult.port attribute of

--- a/Lib/test/test_urlparse.py +++ b/Lib/test/test_urlparse.py @@ -554,29 +554,27 @@ class UrlParseTestCase(unittest.TestCase self.assertEqual(p.port, 80) self.assertEqual(p.geturl(), url)

def test_attributes_bad_port(self):

-

-

-

def test_attributes_without_netloc(self): # This example is straight from RFC 3261. It looks like it

--- 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)

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -15,6 +15,9 @@ Core and Builtins Library ------- +- Issue #20059: urllib.parse raises ValueError on all invalid ports.