Skip to content

Commit 2bdd503

Browse files
gh-48181: Document codecs.charmap_build (#135997)
1 parent 75f4059 commit 2bdd503

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Doc/library/codecs.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ any codec:
5353
:exc:`UnicodeDecodeError`). Refer to :ref:`codec-base-classes` for more
5454
information on codec error handling.
5555

56+
.. function:: charmap_build(string)
57+
58+
Return a mapping suitable for encoding with a custom single-byte encoding.
59+
Given a :class:`str` *string* of up to 256 characters representing a
60+
decoding table, returns either a compact internal mapping object
61+
``EncodingMap`` or a :class:`dictionary <dict>` mapping character ordinals
62+
to byte values. Raises a :exc:`TypeError` on invalid input.
63+
5664
The full details for each codec can also be looked up directly:
5765

5866
.. function:: lookup(encoding, /)

0 commit comments

Comments
 (0)