Hey everyone! I've got a question about the differences between PyPy and CPython, specifically regarding the C API. CPython is written in C and has a dedicated C API that lets you manually call C functions without needing extra libraries like ctypes or cffi. But I'm curious—since PyPy eventually compiles down to C, why doesn't it have a similar C API? Can you actually interface with C manually in PyPy? I know there are other methods for doing this, but I'm really trying to fill in the blanks about creating wrappers and binders between these languages. Appreciate any insights!
1 Answer
Your question is a bit unclear, but just to clarify, both CPython and PyPy can use C Foreign Function Interfaces (FFI), so the fact they are implemented in C isn't really relevant here. If you're looking for a more manual approach versus other methods, could you specify what you're thinking about?

I get that CFFI works for both, but CPython has that actual C API. I'm curious why PyPy lacks one even though it converts to C code later. Also, if I wrap C in an RPython program, I know the JIT won't optimize it, but does anything else optimize it after using ctypes or CFFI?