ctypes exposes no information about the libffi library it is built with and running on, although libffi mismatches are a common source of platform-specific failures (test_ctypes skips are keyed on platform guesses rather than on the libffi version).
libffi 3.5 added a version API: FFI_VERSION_STRING and FFI_VERSION_NUMBER at compile time, ffi_get_version() and ffi_get_version_number() at runtime. Older versions provide nothing.
Add ctypes.LIBFFI_VERSION and ctypes.LIBFFI_VERSION_INFO for the build-time version, and ctypes.libffi_version and ctypes.libffi_version_info for the runtime version. They are only available if the module was built with libffi 3.5 or later.
Activity
gh-157487: Add structured version info for ctypes (GH-157488)