From 19121c097fe78358a28d9e7987315ef008425555 Mon Sep 17 00:00:00 2001 From: Yashraj Date: Mon, 12 Jan 2026 18:29:59 +0530 Subject: [PATCH] gh-141004: Document PyUnicode_IS_COMPACT and PyUnicode_IS_COMPACT_ASCII macros (GH-143494) (cherry picked from commit 42f7c2dfba58a8a8f31aba727d0fc51dd3ce2fce) --- Doc/c-api/unicode.rst | 21 +++++++++++++++++++++ Tools/check-c-api-docs/ignored_c_api.txt | 3 --- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst index 9fa88915c3c023..b7d3aaf3227bf0 100644 --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -65,6 +65,27 @@ Python: .. versionadded:: 3.3 + The structure of a particular object can be determined using the following + macros. + The macros cannot fail; their behavior is undefined if their argument + is not a Python Unicode object. + + .. c:namespace:: NULL + + .. c:macro:: PyUnicode_IS_COMPACT(o) + + True if *o* uses the :c:struct:`PyCompactUnicodeObject` structure. + + .. versionadded:: 3.3 + + + .. c:macro:: PyUnicode_IS_COMPACT_ASCII(o) + + True if *o* uses the :c:struct:`PyASCIIObject` structure. + + .. versionadded:: 3.3 + + The following APIs are C macros and static inlined functions for fast checks and access to internal read-only data of Unicode objects: diff --git a/Tools/check-c-api-docs/ignored_c_api.txt b/Tools/check-c-api-docs/ignored_c_api.txt index 5c96e34b0b2187..e73e235d6c6d6f 100644 --- a/Tools/check-c-api-docs/ignored_c_api.txt +++ b/Tools/check-c-api-docs/ignored_c_api.txt @@ -109,9 +109,6 @@ PyUnstable_EXECUTABLE_KIND_PY_FUNCTION PyUnstable_EXECUTABLE_KIND_SKIP # cpython/pylifecycle.h Py_FrozenMain -# cpython/unicodeobject.h -PyUnicode_IS_COMPACT -PyUnicode_IS_COMPACT_ASCII # pythonrun.h PyErr_Display # cpython/objimpl.h