gh-119182: Complete PyUnicodeWriter documentation (#127607)

This commit is contained in:
Victor Stinner 2024-12-05 10:37:14 +01:00 committed by GitHub
parent 6cf77949fb
commit 1ef6e8ca3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1588,6 +1588,11 @@ object.
Create a Unicode writer instance. 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. Set an exception and return ``NULL`` on error.
.. c:function:: PyObject* PyUnicodeWriter_Finish(PyUnicodeWriter *writer) .. c:function:: PyObject* PyUnicodeWriter_Finish(PyUnicodeWriter *writer)
@ -1596,12 +1601,16 @@ object.
Set an exception and return ``NULL`` on error. Set an exception and return ``NULL`` on error.
The writer instance is invalid after this call.
.. c:function:: void PyUnicodeWriter_Discard(PyUnicodeWriter *writer) .. c:function:: void PyUnicodeWriter_Discard(PyUnicodeWriter *writer)
Discard the internal Unicode buffer and destroy the writer instance. Discard the internal Unicode buffer and destroy the writer instance.
If *writer* is ``NULL``, no operation is performed. 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) .. c:function:: int PyUnicodeWriter_WriteChar(PyUnicodeWriter *writer, Py_UCS4 ch)
Write the single Unicode character *ch* into *writer*. Write the single Unicode character *ch* into *writer*.