Skip to content

Commit 3c96475

Browse files
lysnikolaouvstinner
authored andcommitted
Address feedback
1 parent ce6a3a6 commit 3c96475

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

Doc/c-api/unicode.rst

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -310,46 +310,61 @@ These APIs can be used for fast direct character conversions:
310310
.. c:function:: Py_ssize_t PyUCS4_ToLower(Py_UCS4 ch, Py_UCS4 *buffer, Py_ssize_t 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
314-
(e.g. a maximum of two character for Unicode 16.0), and
313+
able to hold as many characters needed for *ch* to be lower cased, and
315314
return the number of characters stored. If at some point a buffer overflow
316315
is detected, an :exc:`ValueError` is raised and ``-1`` is returned.
317316
317+
In Unicode 16.0, any character can be lowercased into a buffer of *size* ``2``.
318+
See also :c:macro:`PyUCS4_CASE_CONVERSION_BUFFER_SIZE`.
319+
318320
.. versionadded:: next
319321
320322
321323
.. c:function:: Py_ssize_t PyUCS4_ToUpper(Py_UCS4 ch, Py_UCS4 *buffer, Py_ssize_t size)
322324
323325
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
325-
(e.g. a maximum of three character for Unicode 16.0), and
326+
able to hold as many characters needed for *ch* to be upper cased, and
326327
return the number of characters stored. If at some point a buffer overflow
327328
is detected, an :exc:`ValueError` is raised and ``-1`` is returned.
328329
330+
In Unicode 16.0, any character can be uppercased into a buffer of *size* ``3``.
331+
See also :c:macro:`PyUCS4_CASE_CONVERSION_BUFFER_SIZE`.
332+
329333
.. versionadded:: next
330334
331335
332336
.. c:function:: Py_ssize_t PyUCS4_ToTitle(Py_UCS4 ch, Py_UCS4 *buffer, Py_ssize_t size)
333337
334338
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
336-
(e.g. a maximum of three character for Unicode 16.0), and
339+
able to hold as many characters needed for *ch* to be title cased, and
337340
return the number of characters stored. If at some point a buffer overflow
338341
is detected, an :exc:`ValueError` is raised and ``-1`` is returned.
339342
343+
In Unicode 16.0, any character can be titlecased into a buffer of *size* ``3``.
344+
See also :c:macro:`PyUCS4_CASE_CONVERSION_BUFFER_SIZE`.
345+
340346
.. versionadded:: next
341347
342348
343349
.. c:function:: Py_ssize_t PyUCS4_ToFolded(Py_UCS4 ch, Py_UCS4 *buffer, Py_ssize_t size)
344350
345351
Foldcase *ch*, store result in *buffer*, which should be
346-
able to hold as many characters needed for *ch* to be foldcased
347-
(e.g. a maximum of three character for Unicode 16.0), and
352+
able to hold as many characters needed for *ch* to be foldcased, and
348353
return the number of characters stored. If at some point a buffer overflow
349354
is detected, an :exc:`ValueError` is raised and ``-1`` is returned.
350355
356+
In Unicode 16.0, any character can be foldcased into a buffer of *size* ``3``.
357+
See also :c:macro:`PyUCS4_CASE_CONVERSION_BUFFER_SIZE`.
358+
351359
.. versionadded:: next
352360
361+
.. c:macro:: PyUCS4_CASE_CONVERSION_BUFFER_SIZE
362+
363+
The minimum buffer size needed for any call to :c:func:`PyUCS4_ToLower`,
364+
:c:func:`PyUCS4_ToUpper`, :c:func:`PyUCS4_ToTitle`, or
365+
:c:func:`PyUCS4_ToFolded`. That is, ``3`` for Unicode 16.0.
366+
367+
.. versionadded:: next
353368
354369
355370
These APIs can be used to work with surrogates:

Tools/unicode/makeunicodedata.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
# * Doc/library/stdtypes.rst, and
4545
# * Doc/library/unicodedata.rst
4646
# * Doc/reference/lexical_analysis.rst (three occurrences)
47+
# * Doc/c-api-unicode.rst (in case conversion APIs)
4748
UNIDATA_VERSION = "17.0.0"
4849
UNICODE_DATA = "UnicodeData%s.txt"
4950
COMPOSITION_EXCLUSIONS = "CompositionExclusions%s.txt"

0 commit comments

Comments
 (0)