@@ -310,46 +310,61 @@ These APIs can be used for fast direct character conversions:
310
310
.. c:function:: Py_ssize_t PyUCS4_ToLower(Py_UCS4 ch, Py_UCS4 *buffer, Py_ssize_t size)
311
311
312
312
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
315
314
return the number of characters stored. If at some point a buffer overflow
316
315
is detected, an :exc: `ValueError ` is raised and ``-1 `` is returned.
317
316
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
+
318
320
.. versionadded :: next
319
321
320
322
321
323
.. c :function :: Py_ssize_t PyUCS4_ToUpper (Py_UCS4 ch, Py_UCS4 *buffer, Py_ssize_t size)
322
324
323
325
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
326
327
return the number of characters stored. If at some point a buffer overflow
327
328
is detected, an :exc: `ValueError ` is raised and ``-1 `` is returned.
328
329
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
+
329
333
.. versionadded :: next
330
334
331
335
332
336
.. c :function :: Py_ssize_t PyUCS4_ToTitle (Py_UCS4 ch, Py_UCS4 *buffer, Py_ssize_t size)
333
337
334
338
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
337
340
return the number of characters stored. If at some point a buffer overflow
338
341
is detected, an :exc: `ValueError ` is raised and ``-1 `` is returned.
339
342
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
+
340
346
.. versionadded :: next
341
347
342
348
343
349
.. c :function :: Py_ssize_t PyUCS4_ToFolded (Py_UCS4 ch, Py_UCS4 *buffer, Py_ssize_t size)
344
350
345
351
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
348
353
return the number of characters stored. If at some point a buffer overflow
349
354
is detected, an :exc: `ValueError ` is raised and ``-1 `` is returned.
350
355
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
+
351
359
.. versionadded :: next
352
360
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
353
368
354
369
355
370
These APIs can be used to work with surrogates:
0 commit comments