]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-46236: Document PyUnicode_BuildEncodingMap (#133770)
authorStan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Tue, 13 May 2025 23:23:43 +0000 (00:23 +0100)
committerGitHub <noreply@github.com>
Tue, 13 May 2025 23:23:43 +0000 (19:23 -0400)
Doc/c-api/unicode.rst
Doc/data/refcounts.dat

index 7baf8de10c8175557adc9986d330e166849e40b8..9e679d080fb5f5133a72fc801eeb8367d78fc620 100644 (file)
@@ -621,6 +621,16 @@ APIs:
    decref'ing the returned objects.
 
 
+.. c:function:: PyObject* PyUnicode_BuildEncodingMap(PyObject* string)
+
+   Return a mapping suitable for decoding a custom single-byte encoding.
+   Given a Unicode string *string* of up to 256 characters representing an encoding
+   table, returns either a compact internal mapping object or a dictionary
+   mapping character ordinals to byte values. Raises a :exc:`TypeError` and
+   return ``NULL`` on invalid input.
+   .. versionadded:: 3.2
+
+
 .. c:function:: const char* PyUnicode_GetDefaultEncoding(void)
 
    Return the name of the default string encoding, ``"utf-8"``.
index 964914aa714f095f7eed42204edc0bf5fc8f1822..042cae5f18ab1add41959a4409fe0ba27c9bac1c 100644 (file)
@@ -2759,6 +2759,9 @@ PyUnicode_FromFormatV:va_list:args::
 PyUnicode_FromOrdinal:PyObject*::+1:
 PyUnicode_FromOrdinal:int:ordinal::
 
+PyUnicode_BuildEncodingMap:PyObject*::+1:
+PyUnicode_BuildEncodingMap:PyObject*:string:::
+
 PyUnicode_GetDefaultEncoding:const char*:::
 PyUnicode_GetDefaultEncoding::void::