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 it the same as the CPython C API? If PyPy was run on top of CPython would it change this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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
ctypesto 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.