Skip to content

Commit 78a04b3

Browse files
[3.13] gh-46236: Document PyUnicode_BuildEncodingMap (#133770)
1 parent 50b45c4 commit 78a04b3

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Doc/c-api/unicode.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,16 @@ APIs:
621621
decref'ing the returned objects.
622622
623623
624+
.. c:function:: PyObject* PyUnicode_BuildEncodingMap(PyObject* string)
625+
626+
Return a mapping suitable for decoding a custom single-byte encoding.
627+
Given a Unicode string *string* of up to 256 characters representing an encoding
628+
table, returns either a compact internal mapping object or a dictionary
629+
mapping character ordinals to byte values. Raises a :exc:`TypeError` and
630+
return ``NULL`` on invalid input.
631+
.. versionadded:: 3.2
632+
633+
624634
.. c:function:: const char* PyUnicode_GetDefaultEncoding(void)
625635
626636
Return the name of the default string encoding, ``"utf-8"``.

Doc/data/refcounts.dat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2759,6 +2759,9 @@ PyUnicode_FromFormatV:va_list:args::
27592759
PyUnicode_FromOrdinal:PyObject*::+1:
27602760
PyUnicode_FromOrdinal:int:ordinal::
27612761

2762+
PyUnicode_BuildEncodingMap:PyObject*::+1:
2763+
PyUnicode_BuildEncodingMap:PyObject*:string:::
2764+
27622765
PyUnicode_GetDefaultEncoding:const char*:::
27632766
PyUnicode_GetDefaultEncoding::void::
27642767

0 commit comments

Comments
 (0)