]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-46236: Document PyUnicode_BuildEncodingMap (#133270)
authorStan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Fri, 9 May 2025 15:19:07 +0000 (16:19 +0100)
committerGitHub <noreply@github.com>
Fri, 9 May 2025 15:19:07 +0000 (17:19 +0200)
Doc/c-api/unicode.rst
Doc/data/refcounts.dat

index 95987e872ce639df42d93c935d4cef52117f267d..cdd90d05b70b36df33b6337fba66b7d946b12bc3 100644 (file)
@@ -645,6 +645,17 @@ APIs:
    difference being that it decrements the reference count of *right* by one.
 
 
+.. 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 1eca7bca2e29805330e456b6f75dd650ca5d0301..59b31ccf7bc471074c8e3b683bb4e1152a897fea 100644 (file)
@@ -2778,6 +2778,9 @@ PyUnicode_AppendAndDel:void:::
 PyUnicode_AppendAndDel:PyObject**:p_left:0:
 PyUnicode_AppendAndDel:PyObject*:right:-1:
 
+PyUnicode_BuildEncodingMap:PyObject*::+1:
+PyUnicode_BuildEncodingMap:PyObject*:string:::
+
 PyUnicode_GetDefaultEncoding:const char*:::
 PyUnicode_GetDefaultEncoding::void::