Skip to content

Commit 89e86c9

Browse files
committed
Don't use abi_only items in the headers check
1 parent de489c0 commit 89e86c9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Tools/scripts/stable_abi.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,21 @@ def do_unixy_check(manifest, args):
304304
manifest, LDLIBRARY, expected_symbols, dynamic=False)
305305

306306
# Check definitions in the header files
307+
expected_defs = set(item.name for item in manifest.select(
308+
{'function', 'data'}, include_abi_only=False, ifdef=feature_defines,
309+
))
307310
found_defs = gcc_get_limited_api_definitions(['Include/Python.h'])
308-
missing_defs = expected_symbols - found_defs
311+
missing_defs = expected_defs - found_defs
309312
okay &= _report_unexpected_items(
310313
missing_defs,
311314
'Some expected declarations were not declared in '
312315
+ '"Include/Python.h" with Py_LIMITED_API:')
313-
extra_defs = found_defs - expected_symbols
316+
317+
# Some Limited API macros are defined in terms of private symbols.
318+
# These are not part of Limited API (even though they're defined with
319+
# Py_LIMITED_API). They must be part of the Stable ABI, though.
320+
private_symbols = {n for n in expected_symbols if n.startswith('_')}
321+
extra_defs = found_defs - expected_defs - private_symbols
314322
okay &= _report_unexpected_items(
315323
extra_defs,
316324
'Some extra declarations were found in "Include/Python.h" '

0 commit comments

Comments
 (0)