Skip to content

Commit 4eed282

Browse files
authored
bpo-39560: Document PyUnicode_FromKindAndData() kind transformation (GH-23848)
1 parent 8b93f0e commit 4eed282

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Doc/c-api/unicode.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,12 @@ APIs:
421421
:c:func:`PyUnicode_KIND`). The *buffer* must point to an array of *size*
422422
units of 1, 2 or 4 bytes per character, as given by the kind.
423423
424+
If necessary, the input *buffer* is copied and transformed into the
425+
canonical representation. For example, if the *buffer* is a UCS4 string
426+
(:c:macro:`PyUnicode_4BYTE_KIND`) and it consists only of codepoints in
427+
the UCS1 range, it will be transformed into UCS1
428+
(:c:macro:`PyUnicode_1BYTE_KIND`).
429+
424430
.. versionadded:: 3.3
425431
426432

0 commit comments

Comments
 (0)