Skip to content

Commit 18388f9

Browse files
committed
Sphinx extension: tolerate macros documented as functions
1 parent e010f0a commit 18388f9

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎Doc/tools/extensions/c_annotations.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,13 @@ def add_annotations(app: Sphinx, doctree: nodes.document) -> None:
177177

178178
# Stable ABI annotation.
179179
if record := stable_abi_data.get(name):
180-
if ROLE_TO_OBJECT_TYPE[record.role] != objtype:
180+
record_object_type = ROLE_TO_OBJECT_TYPE[record.role]
181+
if (record_object_type != objtype
182+
# Some macros are documented as functions
183+
and not(record_object_type == 'macro' and objtype == 'function')):
181184
msg = (
182185
f"Object type mismatch in limited API annotation for {name}: "
183-
f"{ROLE_TO_OBJECT_TYPE[record.role]!r} != {objtype!r}"
186+
f"{record_object_type!r} != {objtype!r}"
184187
)
185188
raise ValueError(msg)
186189
annotation = _stable_abi_annotation(record)

0 commit comments

Comments
 (0)