- Name: Dave Malcolm
- Email: <firstname.lastname@example.org>
- Targeted release: [[Releases/<number> | Fedora <number> ]]
- Last updated: (DATE)
- Percentage of completion: XX%
ctypes is a Python module that allows Python code to make arbitrary function calls into C libraries.
Unfortunately, such Python code needs to provide its own view of the layout of C-level type information, and if this is not in-sync with the actual C code, it it likely to segfault the python process.
The underlying libraries are built with the necessary information, for use by debugging tools, in "DWARF" format, but we strip this out and place it into "debuginfo" packages, since it is large.
The idea is to investigate if we can only strip part of the debuginfo, keeping the type information as part of the main library (assuming this doesn't get too large), and to then patch python, python3 and pypy to take account of this.
We may want to only do this for a subset of libraries e.g. the ones that are high-value for PyPy (e.g. database connectivity).
Potentially this could benefit other language runtimes that support similar FFI behavior.
Benefit to Fedora
This is (potentially) a distribution-wide change that would greatly improve the platform for use by PyPy, and thus Fedora would be an even better platform for PyPy usage.
- investigate sizes of the various parts of debuginfo across the various packages in the distro
- potentially come up with some subset that are worth targeting
- change the DWARF-stripping behavior to retain the information we need
- patch libffi to check type information, and to extract it (for the case where no type information is provided by the caller)
- patch ctypes within python and python3 to use the libffi new features, raising TypeError, or similar, if the types don't match correctly
- patch pypy to cover the same ground
- ensure that all of the various DWARF-handling programs can cope with the new division; in particular, gdb