From 8ba41c1e2d471493254ee66cdbd50b78f0db6ce0 Mon Sep 17 00:00:00 2001 From: Kanishk Pachauri Date: Thu, 27 Feb 2025 00:21:00 +0530 Subject: [PATCH] gh-130578: clarify urllib.parse.quote parameter defaults behavior --- Doc/library/urllib.parse.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst index 44a9c79cba2216..51e051bc48cc7a 100644 --- a/Doc/library/urllib.parse.rst +++ b/Doc/library/urllib.parse.rst @@ -638,8 +638,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.