From 89e86c9263bd18d69a2ca5f13e674a1890a8f8eb Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Fri, 16 Apr 2021 16:02:52 +0200 Subject: [PATCH] Don't use abi_only items in the headers check --- Tools/scripts/stable_abi.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Tools/scripts/stable_abi.py b/Tools/scripts/stable_abi.py index e397138f7cffb2..399153db81c254 100755 --- a/Tools/scripts/stable_abi.py +++ b/Tools/scripts/stable_abi.py @@ -304,13 +304,21 @@ def do_unixy_check(manifest, args): manifest, LDLIBRARY, expected_symbols, dynamic=False) # Check definitions in the header files + expected_defs = set(item.name for item in manifest.select( + {'function', 'data'}, include_abi_only=False, ifdef=feature_defines, + )) found_defs = gcc_get_limited_api_definitions(['Include/Python.h']) - missing_defs = expected_symbols - found_defs + missing_defs = expected_defs - found_defs okay &= _report_unexpected_items( missing_defs, 'Some expected declarations were not declared in ' + '"Include/Python.h" with Py_LIMITED_API:') - extra_defs = found_defs - expected_symbols + + # Some Limited API macros are defined in terms of private symbols. + # These are not part of Limited API (even though they're defined with + # Py_LIMITED_API). They must be part of the Stable ABI, though. + private_symbols = {n for n in expected_symbols if n.startswith('_')} + extra_defs = found_defs - expected_defs - private_symbols okay &= _report_unexpected_items( extra_defs, 'Some extra declarations were found in "Include/Python.h" '