PyPy C/API access
I've been looking through the reference docs and can't find any mention of a C API for PyPy. Does it exist? If so is 开发者_StackOverflow中文版it the same as the CPython C API? If PyPy was run on top of CPython would it change this?
PyPy has alpha-level support for the CPython extension API via an emulation layer called CPyExt. Here's a blog post introducing the support; here's a later one discussing it. If your goal is to interface with a C library, you're probably best off just writing a Python wrapper module that uses ctypes
to call into it.
Running PyPy on CPython wouldn't help (besides slowing things down terribly), because the API wouldn't interact with PyPy's object model—it would interact with that of the CPython host environment.
精彩评论