Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f34ec09

Browse files
gh-46236: Document PyUnicode_BuildEncodingMap (#133270)
1 parent cd2f234 commit f34ec09

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Doc/c-api/unicode.rst

+11
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,17 @@ APIs:
645645
difference being that it decrements the reference count of *right* by one.
646646
647647
648+
.. c:function:: PyObject* PyUnicode_BuildEncodingMap(PyObject* string)
649+
650+
Return a mapping suitable for decoding a custom single-byte encoding.
651+
Given a Unicode string *string* of up to 256 characters representing an encoding
652+
table, returns either a compact internal mapping object or a dictionary
653+
mapping character ordinals to byte values. Raises a :exc:`TypeError` and
654+
return ``NULL`` on invalid input.
655+
656+
.. versionadded:: 3.2
657+
658+
648659
.. c:function:: const char* PyUnicode_GetDefaultEncoding(void)
649660
650661
Return the name of the default string encoding, ``"utf-8"``.

Doc/data/refcounts.dat

+3
Original file line numberDiff line numberDiff line change
@@ -2778,6 +2778,9 @@ PyUnicode_AppendAndDel:void:::
27782778
PyUnicode_AppendAndDel:PyObject**:p_left:0:
27792779
PyUnicode_AppendAndDel:PyObject*:right:-1:
27802780

2781+
PyUnicode_BuildEncodingMap:PyObject*::+1:
2782+
PyUnicode_BuildEncodingMap:PyObject*:string:::
2783+
27812784
PyUnicode_GetDefaultEncoding:const char*:::
27822785
PyUnicode_GetDefaultEncoding::void::
27832786

0 commit comments

Comments
 (0)