https://github.com/python/cpython/commit/9ad1516357432aea6c70b8ba43eb6704da132070 commit: 9ad1516357432aea6c70b8ba43eb6704da132070 branch: 3.14 author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com> committer: vstinner <vstin...@python.org> date: 2025-05-09T15:24:59Z summary:
[3.14] gh-46236: Document PyUnicode_BuildEncodingMap (GH-133270) (#133769) gh-46236: Document PyUnicode_BuildEncodingMap (GH-133270) (cherry picked from commit f34ec09ba51070b0693d7ced8e57e77d71beb48d) Co-authored-by: Stan Ulbrych <89152624+stanfromirel...@users.noreply.github.com> files: M Doc/c-api/unicode.rst M Doc/data/refcounts.dat diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst index 95987e872ce639..cdd90d05b70b36 100644 --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -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"``. diff --git a/Doc/data/refcounts.dat b/Doc/data/refcounts.dat index ca99b9e6d37141..c97cd2b8d1e3cb 100644 --- a/Doc/data/refcounts.dat +++ b/Doc/data/refcounts.dat @@ -2781,6 +2781,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:: _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com