diff --git a/abi3audit/_object.py b/abi3audit/_object.py index 56f66b7..4339a71 100644 --- a/abi3audit/_object.py +++ b/abi3audit/_object.py @@ -152,17 +152,13 @@ def __iter__(self) -> Iterator[Symbol]: raise SharedObjectError("shared object has no symbol table") for symbol in symtab_cmd.symbols: - # TODO(ww): Do a better job of filtering here. - # The Mach-O symbol table includes all kinds of junk, including - # symbolic entries for debuggers. We should exclude all of - # these non-function/data entries, as well as any symbols - # that isn't marked as external (since we're linking against - # the Python interpreter for the ABI). - if (name := symbol.name) is None: + # We only care about symbols that have the external bit set, + # since these are the ones resolved when linking to CPython. + if not symbol.type & 0x01: continue # All symbols on macOS are prefixed with _; remove it. - yield Symbol(name[1:]) + yield Symbol(symbol.name[1:]) class _Dll(_SharedObjectBase):