[Python-3000] Cross-interpreter FFI for Python 3000?
pedronis at strakt.com
Wed Aug 9 01:18:06 CEST 2006
Guido van Rossum wrote:
> On 8/8/06, Terry Reedy <tjreedy at udel.edu> wrote:
>>>I would suggest that PyPy's use of ctypes, coupled with the inclusion of
>>>ctypes in the Python 2.5 stdlib, means that ctypes could reasonably be
>>>considered a defacto standard for a C FFI in Python at this point.
>>Intriguing idea. I know that the Pygame folks, for example, are
>>experimenting with rewrapping the SDL (Simple Directmedia Library, the core
>>of Pygame) in ctypes.
> Isn't a problem with ctypes that such extensions can no longer
> guarantee "no segfaults"? This pretty much completely rules them out
> for use in sandboxes such as what Brett Cannon is currently working
> on. With hand-written extensions at least you can audit them to decide
> whether they are safe enough.
in PyPy rctypes approach the extensions still get compiled to c code,
and ctypes-like calls get resolved to normal c calls, although at some
point a ctypes module is going to be exposed by PyPy, in the rctypes
approach such an exposed ctypes is not a requirement at all.
Rctypes gives ctypes-like C gluing to RPython, a different level
from normal application-level full Python. And indeed (although with
rough edges and some missing features at the moment) PyPy tool-chain can
produce CPython extensions from such rpython+rctypes extension code.
More information about the Python-3000