From 576828db23677c8ae7e8179d2c91a0a722716eb7 Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Wed, 24 Sep 2025 21:22:27 +0800 Subject: [PATCH 1/4] Update base64.rst --- Doc/library/base64.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Doc/library/base64.rst b/Doc/library/base64.rst index 529a7242443820..1d5dd2aefe656e 100644 --- a/Doc/library/base64.rst +++ b/Doc/library/base64.rst @@ -74,8 +74,11 @@ POST request. of length 2 which specifies the alternative alphabet used instead of the ``+`` and ``/`` characters. - A :exc:`binascii.Error` exception is raised - if *s* is incorrectly padded. + A :exc:`binascii.Error` exception is raised if *s* contains incorrect padding. + When *validate* is ``False`` (the default), extra padding characters and + discontinuous padding characters (``=`` characters in the middle of the string) + are silently ignored. When *validate* is ``True``, such incorrect padding + will result in a :exc:`binascii.Error`. If *validate* is ``False`` (the default), characters that are neither in the normal base-64 alphabet nor the alternative alphabet are @@ -86,7 +89,6 @@ POST request. For more information about the strict base64 check, see :func:`binascii.a2b_base64` May assert or raise a :exc:`ValueError` if the length of *altchars* is not 2. - .. function:: standard_b64encode(s) Encode :term:`bytes-like object` *s* using the standard Base64 alphabet From ddf2e67ee84444d796b2246a7c2f52bf47c55afa Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Wed, 24 Sep 2025 21:23:42 +0800 Subject: [PATCH 2/4] Update base64.rst --- Doc/library/base64.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/library/base64.rst b/Doc/library/base64.rst index 1d5dd2aefe656e..48bdcdcc17f5d9 100644 --- a/Doc/library/base64.rst +++ b/Doc/library/base64.rst @@ -89,6 +89,7 @@ POST request. For more information about the strict base64 check, see :func:`binascii.a2b_base64` May assert or raise a :exc:`ValueError` if the length of *altchars* is not 2. + .. function:: standard_b64encode(s) Encode :term:`bytes-like object` *s* using the standard Base64 alphabet From 40391928e10d55e61287be39aeb8e96ca0468288 Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Wed, 24 Sep 2025 21:27:41 +0800 Subject: [PATCH 3/4] Fix lint CI --- Doc/library/base64.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/base64.rst b/Doc/library/base64.rst index 48bdcdcc17f5d9..dd36c075f3b604 100644 --- a/Doc/library/base64.rst +++ b/Doc/library/base64.rst @@ -74,10 +74,10 @@ POST request. of length 2 which specifies the alternative alphabet used instead of the ``+`` and ``/`` characters. - A :exc:`binascii.Error` exception is raised if *s* contains incorrect padding. - When *validate* is ``False`` (the default), extra padding characters and + A :exc:`binascii.Error` exception is raised if *s* contains incorrect padding. + When *validate* is ``False`` (the default), extra padding characters and discontinuous padding characters (``=`` characters in the middle of the string) - are silently ignored. When *validate* is ``True``, such incorrect padding + are silently ignored. When *validate* is ``True``, such incorrect padding will result in a :exc:`binascii.Error`. If *validate* is ``False`` (the default), characters that are neither From 3e9df9332bd9b6741138c1f38d7849ac0fdc4696 Mon Sep 17 00:00:00 2001 From: Weilin Du <108666168+LamentXU123@users.noreply.github.com> Date: Wed, 24 Sep 2025 21:50:06 +0800 Subject: [PATCH 4/4] change "string" to "payload" --- Doc/library/base64.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/base64.rst b/Doc/library/base64.rst index dd36c075f3b604..f9e0e40662ac1b 100644 --- a/Doc/library/base64.rst +++ b/Doc/library/base64.rst @@ -76,7 +76,7 @@ POST request. A :exc:`binascii.Error` exception is raised if *s* contains incorrect padding. When *validate* is ``False`` (the default), extra padding characters and - discontinuous padding characters (``=`` characters in the middle of the string) + discontinuous padding characters (``=`` characters in the middle of the payload) are silently ignored. When *validate* is ``True``, such incorrect padding will result in a :exc:`binascii.Error`.