From 9be327a24289e32d2c7773571cd0b20dc802d3d7 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Fri, 18 Apr 2025 21:18:53 +0100 Subject: [PATCH 1/3] Add Py_UNICODE_REPLACEMENT_CHARACTER --- Doc/c-api/unicode.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst index 778ee9890c5a82..9fd0dbf00e647f 100644 --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -193,6 +193,14 @@ are available through these macros which are mapped to C functions depending on the Python configuration. +.. c:macro:: Py_UNICODE_REPLACEMENT_CHARACTER + + The Unicode code point ``U+FFFD`` (REPLACEMENT CHARACTER). + + This Unicode character is used as the replacement character during + decoding if the errors argument is set to "replace". + + .. c:function:: int Py_UNICODE_ISSPACE(Py_UCS4 ch) Return ``1`` or ``0`` depending on whether *ch* is a whitespace character. From 14c66f394d1c2623d9ff6e564b29c1f188248dab Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Tue, 22 Apr 2025 10:45:13 +0100 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Victor Stinner --- Doc/c-api/unicode.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst index 9fd0dbf00e647f..63ad81e5354c01 100644 --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -195,10 +195,10 @@ the Python configuration. .. c:macro:: Py_UNICODE_REPLACEMENT_CHARACTER - The Unicode code point ``U+FFFD`` (REPLACEMENT CHARACTER). + The Unicode code point ``U+FFFD`` (replacement character). This Unicode character is used as the replacement character during - decoding if the errors argument is set to "replace". + decoding if the *errors* argument is set to "replace". .. c:function:: int Py_UNICODE_ISSPACE(Py_UCS4 ch) From 92cb89beb86a5626ff58f9d8243065734ee5e3f5 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Tue, 22 Apr 2025 10:47:07 +0100 Subject: [PATCH 3/3] Move --- Doc/c-api/unicode.rst | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst index 63ad81e5354c01..e0c471499fb377 100644 --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -193,14 +193,6 @@ are available through these macros which are mapped to C functions depending on the Python configuration. -.. c:macro:: Py_UNICODE_REPLACEMENT_CHARACTER - - The Unicode code point ``U+FFFD`` (replacement character). - - This Unicode character is used as the replacement character during - decoding if the *errors* argument is set to "replace". - - .. c:function:: int Py_UNICODE_ISSPACE(Py_UCS4 ch) Return ``1`` or ``0`` depending on whether *ch* is a whitespace character. @@ -1019,6 +1011,17 @@ generic ones are documented for simplicity. Generic Codecs """""""""""""" +The following macro is provided: + + +.. c:macro:: Py_UNICODE_REPLACEMENT_CHARACTER + + The Unicode code point ``U+FFFD`` (replacement character). + + This Unicode character is used as the replacement character during + decoding if the *errors* argument is set to "replace". + + These are the generic codec APIs: