From 694040438557ab3282d5576023e9bbb2e30e8507 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Mon, 1 Dec 2025 17:24:48 +0000 Subject: [PATCH] Fix pulling from comments --- Tools/check-c-api-docs/main.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Tools/check-c-api-docs/main.py b/Tools/check-c-api-docs/main.py index e6b55b6ad29da4..019b603c2dd2fd 100644 --- a/Tools/check-c-api-docs/main.py +++ b/Tools/check-c-api-docs/main.py @@ -8,6 +8,8 @@ SIMPLE_MACRO_REGEX = re.compile(r"# *define *(\w+)(\(.+\))? ") SIMPLE_INLINE_REGEX = re.compile(r"static inline .+( |\n)(\w+)") SIMPLE_DATA_REGEX = re.compile(r"PyAPI_DATA\(.+\) (\w+)") +C_BLOCK_COMMENT_REGEX = re.compile(r"/\*.*?\*/", re.DOTALL) +C_LINE_COMMENT_REGEX = re.compile(r"//.*$", re.MULTILINE) CPYTHON = Path(__file__).parent.parent.parent INCLUDE = CPYTHON / "Include" @@ -97,6 +99,9 @@ def scan_file_for_docs(filename: str, text: str) -> tuple[list[str], list[str]]: documented_ignored: list[str] = [] colors = _colorize.get_colors() + text = C_BLOCK_COMMENT_REGEX.sub("", text) + text = C_LINE_COMMENT_REGEX.sub("", text) + def check_for_name(name: str) -> None: documented = is_documented(name) if documented and (name in IGNORED):