Skip to content

Commit d7ed172

Browse files
lysnikolaouvstinner
authored andcommitted
Document the maximum numbers of characters needed in the buffer
1 parent 10c282d commit d7ed172

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Doc/c-api/unicode.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,8 @@ These APIs can be used for fast direct character conversions:
310310
.. c:function:: Py_ssize_t PyUnicode_ToLower(Py_UCS4 ch, Py_UCS4 *buffer, int size)
311311
312312
Convert *ch* to lower case, store result in *buffer*, which should be
313-
able to hold as many characters needed for *ch* to be lower cased, and
313+
able to hold as many characters needed for *ch* to be lower cased
314+
(e.g. a maximum of two character for Unicode 16.0), and
314315
return the number of characters stored. Passing a ``NULL`` buffer returns
315316
the buffer size needed. If at some point a buffer overflow is detected,
316317
an :exc:`ValueError` is raised and ``-1`` is returned.
@@ -321,7 +322,8 @@ These APIs can be used for fast direct character conversions:
321322
.. c:function:: Py_ssize_t PyUnicode_ToUpper(Py_UCS4 ch, Py_UCS4 *buffer, int size)
322323
323324
Convert *ch* to upper case, store result in *buffer*, which should be
324-
able to hold as many characters needed for *ch* to be upper cased, and
325+
able to hold as many characters needed for *ch* to be upper cased
326+
(e.g. a maximum of three character for Unicode 16.0), and
325327
return the number of characters stored. Passing a ``NULL`` buffer returns
326328
the buffer size needed. If at some point a buffer overflow is detected,
327329
an :exc:`ValueError` is raised and ``-1`` is returned.
@@ -332,7 +334,8 @@ These APIs can be used for fast direct character conversions:
332334
.. c:function:: Py_ssize_t PyUnicode_ToTitle(Py_UCS4 ch, Py_UCS4 *buffer, int size)
333335
334336
Convert *ch* to title case, store result in *buffer*, which should be
335-
able to hold as many characters needed for *ch* to be title cased, and
337+
able to hold as many characters needed for *ch* to be title cased
338+
(e.g. a maximum of three character for Unicode 16.0), and
336339
return the number of characters stored. Passing a ``NULL`` buffer returns
337340
the buffer size needed. If at some point a buffer overflow is detected,
338341
an :exc:`ValueError` is raised and ``-1`` is returned.
@@ -343,7 +346,8 @@ These APIs can be used for fast direct character conversions:
343346
.. c:function:: Py_ssize_t PyUnicode_ToFolded(Py_UCS4 ch, Py_UCS4 *buffer, int size)
344347
345348
Foldcase *ch*, store result in *buffer*, which should be
346-
able to hold as many characters needed for *ch* to be foldcased, and
349+
able to hold as many characters needed for *ch* to be foldcased
350+
(e.g. a maximum of three character for Unicode 16.0), and
347351
return the number of characters stored. Passing a ``NULL`` buffer returns
348352
the buffer size needed. If at some point a buffer overflow is detected,
349353
an :exc:`ValueError` is raised and ``-1`` is returned.

0 commit comments

Comments
 (0)