From 63d2ecf17fc5ab12b268c483830ae0077c6fc03b Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Thu, 9 Jul 2026 07:19:50 +0200 Subject: [PATCH] [3.14] gh-130578: clarify urllib.parse.quote parameter defaults behavior (GH-130598) (#153384) gh-130578: clarify urllib.parse.quote parameter defaults behavior (GH-130598) (cherry picked from commit bc9bb7386597e22693662f489a7474998788e228) Co-authored-by: Kanishk Pachauri Co-authored-by: Serhiy Storchaka --- 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 82f31c6bcf53..b58e9456107f 100644 --- a/Doc/library/urllib.parse.rst +++ b/Doc/library/urllib.parse.rst @@ -597,8 +597,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. -- 2.47.3