From: Kanishk Pachauri Date: Thu, 9 Jul 2026 05:11:36 +0000 (+0530) Subject: gh-130578: clarify urllib.parse.quote parameter defaults behavior (#130598) X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=bc9bb7386597e22693662f489a7474998788e228;p=thirdparty%2FPython%2Fcpython.git gh-130578: clarify urllib.parse.quote parameter defaults behavior (#130598) Co-authored-by: Serhiy Storchaka --- diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst index 3ce20311c42c..26e159306c81 100644 --- a/Doc/library/urllib.parse.rst +++ b/Doc/library/urllib.parse.rst @@ -649,8 +649,9 @@ task isn't already covered by the URL parsing functions above. The optional *encoding* and *errors* parameters specify how to deal with non-ASCII characters, as accepted by the :meth:`str.encode` method. - *encoding* defaults to ``'utf-8'``. - *errors* defaults to ``'strict'``, meaning unsupported characters raise a + Although these parameters default to ``None`` in the function signature, + when processing :class:`str` inputs, *encoding* effectively defaults to ``'utf-8'`` + and *errors* to ``'strict'``, meaning unsupported characters raise a :class:`UnicodeEncodeError`. *encoding* and *errors* must not be supplied if *string* is a :class:`bytes`, or a :class:`TypeError` is raised.