# Bug report ### Bug description: The [current implementation](https://github.com/python/cpython/blob/59a691361cb7b1d4fde3b92f98a61490381c62c9/Modules/_ctypes/callbacks.c#L242) is relying on `restype->size` to write the data into a buffer, however, per [libffi contract](https://github.com/libffi/libffi/blob/33cfefc7d93deba08084557e05728c721b276ade/doc/libffi.texi#L1041) > integral types narrower than the system register size are widened Which is not happening here. This has caused a failure on s390x when using libclang. cindex.py calls into libclang through ctypes, which builds the callback closures using libffi. With a c_int return, ctypes writes only the low 32 bits and skips the extension that both the ABI and libffi's closure contract require. We have also opened a PR to fix this temporarily under llvm: https://github.com/llvm/llvm-project/pull/221024 ### CPython versions tested on: 3.11 ### Operating systems tested on: Linux