Skip to content

Commit 92f0ed1

Browse files
authored
gh-89653: PEP 670: Update C API unicode documentation (#92702)
1 parent f9b67ad commit 92f0ed1

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

Doc/c-api/unicode.rst

+11-10
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ access to internal read-only data of Unicode objects:
130130
Return a pointer to the canonical representation cast to UCS1, UCS2 or UCS4
131131
integer types for direct character access. No checks are performed if the
132132
canonical representation has the correct character size; use
133-
:c:func:`PyUnicode_KIND` to select the right macro. Make sure
133+
:c:func:`PyUnicode_KIND` to select the right function. Make sure
134134
:c:func:`PyUnicode_READY` has been called before accessing this.
135135
136136
.. versionadded:: 3.3
@@ -360,40 +360,41 @@ These APIs can be used for fast direct character conversions:
360360
.. c:function:: int Py_UNICODE_TODECIMAL(Py_UCS4 ch)
361361
362362
Return the character *ch* converted to a decimal positive integer. Return
363-
``-1`` if this is not possible. This macro does not raise exceptions.
363+
``-1`` if this is not possible. This function does not raise exceptions.
364364
365365
366366
.. c:function:: int Py_UNICODE_TODIGIT(Py_UCS4 ch)
367367
368368
Return the character *ch* converted to a single digit integer. Return ``-1`` if
369-
this is not possible. This macro does not raise exceptions.
369+
this is not possible. This function does not raise exceptions.
370370
371371
372372
.. c:function:: double Py_UNICODE_TONUMERIC(Py_UCS4 ch)
373373
374374
Return the character *ch* converted to a double. Return ``-1.0`` if this is not
375-
possible. This macro does not raise exceptions.
375+
possible. This function does not raise exceptions.
376376
377377
378378
These APIs can be used to work with surrogates:
379379
380-
.. c:macro:: Py_UNICODE_IS_SURROGATE(ch)
380+
.. c:func:: int Py_UNICODE_IS_SURROGATE(Py_UCS4 ch)
381381
382382
Check if *ch* is a surrogate (``0xD800 <= ch <= 0xDFFF``).
383383
384-
.. c:macro:: Py_UNICODE_IS_HIGH_SURROGATE(ch)
384+
.. c:func:: int Py_UNICODE_IS_HIGH_SURROGATE(Py_UCS4 ch)
385385
386386
Check if *ch* is a high surrogate (``0xD800 <= ch <= 0xDBFF``).
387387
388-
.. c:macro:: Py_UNICODE_IS_LOW_SURROGATE(ch)
388+
.. c:func:: int Py_UNICODE_IS_LOW_SURROGATE(Py_UCS4 ch)
389389
390390
Check if *ch* is a low surrogate (``0xDC00 <= ch <= 0xDFFF``).
391391
392-
.. c:macro:: Py_UNICODE_JOIN_SURROGATES(high, low)
392+
.. c:func:: Py_UCS4 Py_UNICODE_JOIN_SURROGATES(Py_UCS4 high, Py_UCS4 low)
393393
394-
Join two surrogate characters and return a single Py_UCS4 value.
394+
Join two surrogate characters and return a single :c:type:`Py_UCS4` value.
395395
*high* and *low* are respectively the leading and trailing surrogates in a
396-
surrogate pair.
396+
surrogate pair. *high* must be in the range [0xD800; 0xDBFF] and *low* must
397+
be in the range [0xDC00; 0xDFFF].
397398
398399
399400
Creating and accessing Unicode strings

0 commit comments

Comments
 (0)