From 18d152418bdd05e8c8a3d78f1792d75c67cedf56 Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Mon, 30 Sep 2024 16:00:08 -0400 Subject: [PATCH] _audit: relax PyInit check Signed-off-by: William Woodruff --- abi3audit/_audit.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/abi3audit/_audit.py b/abi3audit/_audit.py index 759bf05..b6884f8 100644 --- a/abi3audit/_audit.py +++ b/abi3audit/_audit.py @@ -119,11 +119,13 @@ def audit(so: SharedObject, assume_minimum_abi3: PyVersion = PyVersion(3, 2)) -> if maybe_abi3.added > baseline: future_abi3_objects.add(maybe_abi3) elif sym.name.startswith(("Py", "_Py")): - # exclude the shared object's entry point from reports. - # This is always PyInit_$EXTNAME, e.g. `PyInit_foo` for foo.abi3.so. - if sym.name == "PyInit_" + so.path.with_suffix("").stem: + # Exclude module initialization symbols. Technically + # this should always be `PyInit_{filename}` but there can + # be multiple if a shared object contains multiple extensions; + # see https://github.com/pypa/abi3audit/issues/111. + if sym.name.startswith("PyInit_"): continue - # local symbols are fine, since they are inlined functions + # Local symbols are fine, since they are inlined functions # from the CPython limited API. if sym not in _ALLOWED_SYMBOLS and sym.visibility != "local": non_abi3_symbols.add(sym)