Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit05dfc53

Browse files
authored
gh-90717: Update the documentation for the altchars paremeter in base64 library (GH-94187)
1 parent74d5f61 commit05dfc53

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

‎Doc/library/base64.rst‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,23 @@ The modern interface provides:
5353
Encode the:term:`bytes-like object` *s* using Base64 and return the encoded
5454
:class:`bytes`.
5555

56-
Optional *altchars* must be a:term:`bytes-like object` of at least
57-
length 2 (additional characters are ignored) which specifies an alternative
58-
alphabet for the ``+`` and ``/`` characters. This allows an application to e.g.
59-
generate URL or filesystem safe Base64 strings. The default is ``None``, for
60-
which the standard Base64 alphabet is used.
56+
Optional *altchars* must be a:term:`bytes-like object` of length 2 which
57+
specifies an alternative alphabet for the ``+`` and ``/`` characters.
58+
This allows an application to e.g. generate URL or filesystem safe Base64
59+
strings. The default is ``None``, for which the standard Base64 alphabet is used.
60+
61+
May assert or raise a a:exc:`ValueError` if the length of *altchars* is not 2. Raises a
62+
:exc:`TypeError` if *altchars* is not a:term:`bytes-like object`.
6163

6264

6365
..function::b64decode(s, altchars=None, validate=False)
6466

6567
Decode the Base64 encoded:term:`bytes-like object` or ASCII string
6668
*s* and return the decoded:class:`bytes`.
6769

68-
Optional *altchars* must be a:term:`bytes-like object` or ASCII string of
69-
at leastlength 2(additional characters are ignored) which specifies the
70-
alternative alphabet used instead of the``+`` and ``/`` characters.
70+
Optional *altchars* must be a:term:`bytes-like object` or ASCII string
71+
oflength 2which specifies the alternative alphabet used instead of the
72+
``+`` and ``/`` characters.
7173

7274
A:exc:`binascii.Error` exception is raised
7375
if *s* is incorrectly padded.
@@ -80,6 +82,7 @@ The modern interface provides:
8082

8183
For more information about the strict base64 check, see:func:`binascii.a2b_base64`
8284

85+
May assert or raise a:exc:`ValueError` if the length of *altchars* is not 2.
8386

8487
..function::standard_b64encode(s)
8588

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp