Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix indentation on the output.
  • Loading branch information
ZeroIntensity committed Nov 30, 2025
commit 1d0c8f681ea19bb8c9037c0983588ea91716ab6f
21 changes: 11 additions & 10 deletions Tools/check-c-api-docs/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
if line.startswith("#"):
IGNORED.pop(index)

MISTAKE = """\
MISTAKE = """
If this is a mistake and this script should not be failing, create an
issue and tag Peter (@ZeroIntensity) on it.\
"""
Expand All @@ -35,8 +35,9 @@ def found_undocumented(singular: bool):
them = "it" if singular else "them"
were = "was" if singular else "were"

return textwrap.dedent(
f"""\
return (
textwrap.dedent(
f"""
Found {some} undocumented C API{s}!

Python requires documentation on all public C API symbols, macros, and types.
Expand All @@ -46,9 +47,9 @@ def found_undocumented(singular: bool):

In exceptional cases, certain APIs can be ignored by adding them to
Tools/c-api-docs-check/ignored_c_api.txt

{MISTAKE}\
"""
)
+ MISTAKE
)


Expand All @@ -59,14 +60,15 @@ def found_ignored_documented(singular: bool) -> str:
were = "was" if singular else "were"
they = "it" if singular else "they"

return textwrap.dedent(
f"""\
return (
textwrap.dedent(
f"""
Found {some} C API{s} listed in Tools/c-api-docs-check/ignored_c_api.txt, but
{they} {were} found in the documentation. To fix this, remove {them} from
ignored_c_api.txt.

{MISTAKE}\
"""
)
+ MISTAKE
)


Expand Down Expand Up @@ -181,7 +183,6 @@ def main() -> None:
print(f"-- {len(name_list)} {what} C API{s} --")
for name in name_list:
print(f" - {name}")
print()
print(message)
fail = True

Expand Down
Loading