summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2021-06-03 13:33:44 (GMT)
committerGitHub <noreply@github.com>2021-06-03 13:33:44 (GMT)
commit4eed2821d40373345ed133b2b8d912fef59acab7 (patch)
treedc6bc44bc58265519834c2cee62a4a52e027b1b0
parent8b93f0e696d3fc60fd311c13d5238da73a35e3b3 (diff)
downloadcpython-4eed2821d40373345ed133b2b8d912fef59acab7.zip
cpython-4eed2821d40373345ed133b2b8d912fef59acab7.tar.gz
cpython-4eed2821d40373345ed133b2b8d912fef59acab7.tar.bz2
bpo-39560: Document PyUnicode_FromKindAndData() kind transformation (GH-23848)
-rw-r--r--Doc/c-api/unicode.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst
index 8322d3d..ddc2346 100644
--- a/Doc/c-api/unicode.rst
+++ b/Doc/c-api/unicode.rst
@@ -421,6 +421,12 @@ APIs:
:c:func:`PyUnicode_KIND`). The *buffer* must point to an array of *size*
units of 1, 2 or 4 bytes per character, as given by the kind.
+ If necessary, the input *buffer* is copied and transformed into the
+ canonical representation. For example, if the *buffer* is a UCS4 string
+ (:c:macro:`PyUnicode_4BYTE_KIND`) and it consists only of codepoints in
+ the UCS1 range, it will be transformed into UCS1
+ (:c:macro:`PyUnicode_1BYTE_KIND`).
+
.. versionadded:: 3.3