From 92ef74fd365338adb0ff787ac2288fd25705e0f2 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Sun, 28 Dec 2025 14:58:08 +0000 Subject: [PATCH] gh-143253: Add libabigail suppression file for internal types Changes to internal structs in Include/internal/pycore_*.h cause false positive ABI violations in make check-abidump because these types are transitively reachable from public APIs like PyInterpreterState. The internal struct layout is not part of the public ABI contract. This adds a suppression specification file that filters out types defined in pycore_*.h files using a regex pattern, and explicitly suppresses PyInterpreterState, _PyRuntimeState, and PyThreadState which are public typedefs aliasing internal structs. The Makefile is updated to pass the suppression file to abidiff. --- Makefile.pre.in | 2 +- Misc/libabigail.abignore | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 Misc/libabigail.abignore diff --git a/Makefile.pre.in b/Makefile.pre.in index a6beb96d12a3f2..0b5aef5ee7e671 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1883,7 +1883,7 @@ regen-abidump: all .PHONY: check-abidump check-abidump: all - abidiff $(srcdir)/Doc/data/python$(LDVERSION).abi "libpython$(LDVERSION).so" --drop-private-types --no-architecture --no-added-syms + abidiff $(srcdir)/Doc/data/python$(LDVERSION).abi "libpython$(LDVERSION).so" --drop-private-types --no-architecture --no-added-syms --suppressions $(srcdir)/Misc/libabigail.abignore .PHONY: regen-limited-abi regen-limited-abi: all diff --git a/Misc/libabigail.abignore b/Misc/libabigail.abignore new file mode 100644 index 00000000000000..39c17b3f17041f --- /dev/null +++ b/Misc/libabigail.abignore @@ -0,0 +1,21 @@ +# libabigail suppression file for CPython ABI checks +# +# Suppress types defined directly in internal headers (pycore_*.h) +# Regex matches filenames NOT starting with "pycore_", so pycore_* types are suppressed. +[suppress_type] + source_location_not_regexp = ^([^p]|p[^y]|py[^c]|pyc[^o]|pyco[^r]|pycor[^e]|pycore[^_]) + accessed_through = pointer + +# Suppress public typedefs that alias internal structs. +# These are public names but their underlying struct layout is internal. +[suppress_type] + name = PyInterpreterState + accessed_through = pointer + +[suppress_type] + name = _PyRuntimeState + accessed_through = pointer + +[suppress_type] + name = PyThreadState + accessed_through = pointer