summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2024-12-05 09:37:14 (GMT)
committerGitHub <noreply@github.com>2024-12-05 09:37:14 (GMT)
commit1ef6e8ca3faf2c2b008fb170c7c44c38b86e874a (patch)
tree951c0aee874cb3b9c2b8fe587146e4b633d6de21 /Doc
parent6cf77949fba7b44f6885794b2028f091f42f5d6c (diff)
downloadcpython-1ef6e8ca3faf2c2b008fb170c7c44c38b86e874a.zip
cpython-1ef6e8ca3faf2c2b008fb170c7c44c38b86e874a.tar.gz
cpython-1ef6e8ca3faf2c2b008fb170c7c44c38b86e874a.tar.bz2
gh-119182: Complete PyUnicodeWriter documentation (#127607)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/unicode.rst9
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst
index 59bd766..dcbc880 100644
--- a/Doc/c-api/unicode.rst
+++ b/Doc/c-api/unicode.rst
@@ -1588,6 +1588,11 @@ object.
Create a Unicode writer instance.
+ *length* must be greater than or equal to ``0``.
+
+ If *length* is greater than ``0``, preallocate an internal buffer of
+ *length* characters.
+
Set an exception and return ``NULL`` on error.
.. c:function:: PyObject* PyUnicodeWriter_Finish(PyUnicodeWriter *writer)
@@ -1596,12 +1601,16 @@ object.
Set an exception and return ``NULL`` on error.
+ The writer instance is invalid after this call.
+
.. c:function:: void PyUnicodeWriter_Discard(PyUnicodeWriter *writer)
Discard the internal Unicode buffer and destroy the writer instance.
If *writer* is ``NULL``, no operation is performed.
+ The writer instance is invalid after this call.
+
.. c:function:: int PyUnicodeWriter_WriteChar(PyUnicodeWriter *writer, Py_UCS4 ch)
Write the single Unicode character *ch* into *writer*.