Skip to content

Commit 92ef74f

Browse files
committed
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.
1 parent 9d92ac1 commit 92ef74f

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

Makefile.pre.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,7 @@ regen-abidump: all
18831883

18841884
.PHONY: check-abidump
18851885
check-abidump: all
1886-
abidiff $(srcdir)/Doc/data/python$(LDVERSION).abi "libpython$(LDVERSION).so" --drop-private-types --no-architecture --no-added-syms
1886+
abidiff $(srcdir)/Doc/data/python$(LDVERSION).abi "libpython$(LDVERSION).so" --drop-private-types --no-architecture --no-added-syms --suppressions $(srcdir)/Misc/libabigail.abignore
18871887

18881888
.PHONY: regen-limited-abi
18891889
regen-limited-abi: all

Misc/libabigail.abignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# libabigail suppression file for CPython ABI checks
2+
#
3+
# Suppress types defined directly in internal headers (pycore_*.h)
4+
# Regex matches filenames NOT starting with "pycore_", so pycore_* types are suppressed.
5+
[suppress_type]
6+
source_location_not_regexp = ^([^p]|p[^y]|py[^c]|pyc[^o]|pyco[^r]|pycor[^e]|pycore[^_])
7+
accessed_through = pointer
8+
9+
# Suppress public typedefs that alias internal structs.
10+
# These are public names but their underlying struct layout is internal.
11+
[suppress_type]
12+
name = PyInterpreterState
13+
accessed_through = pointer
14+
15+
[suppress_type]
16+
name = _PyRuntimeState
17+
accessed_through = pointer
18+
19+
[suppress_type]
20+
name = PyThreadState
21+
accessed_through = pointer

0 commit comments

Comments
 (0)