From 7dc95d3d776f06162f89838b0264453da905a657 Mon Sep 17 00:00:00 2001 From: howinator Date: Fri, 14 Apr 2017 00:30:52 -0500 Subject: [PATCH] Cover edge case of square brackets in urllib docs Per bpo-29651, there is an edge case in urllib.parse where a ValueError will be returned if there are unmatched square brackets in the `netloc` attribute of a URL. This behavior is shown [here](https://github.com/python/cpython/blob/e32ec93/Lib/urllib/parse.py#L406-L408). This PR explicitly states this edge case in the docs. --- Doc/library/urllib.parse.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst index 7a5b56f5da69b1..9ee9903e9d192b 100644 --- a/Doc/library/urllib.parse.rst +++ b/Doc/library/urllib.parse.rst @@ -118,6 +118,9 @@ or on combining URL components into a URL string. an invalid port is specified in the URL. See section :ref:`urlparse-result-object` for more information on the result object. + Unmatched square brackets in the :attr:`netloc` attribute will raise a + :exc:`ValueError`. + .. versionchanged:: 3.2 Added IPv6 URL parsing capabilities. @@ -236,6 +239,9 @@ or on combining URL components into a URL string. an invalid port is specified in the URL. See section :ref:`urlparse-result-object` for more information on the result object. + Unmatched square brackets in the :attr:`netloc` attribute will raise a + :exc:`ValueError`. + .. versionchanged:: 3.6 Out-of-range port numbers now raise :exc:`ValueError`, instead of returning :const:`None`.