spacepaste

  1.  
  2. This document describes how to make extensions to the Python interpreter using CPython C API.
  3. Directly using the C API has many caveats - it is error prone to get the details, especially refcounting, right,
  4. only works well on the CPython interpreter and not say PyPy or any future Python implementation. There are multiple solutions
  5. that are easier to do and don't involve coding directly the C API. We recommend using one of the following 3rd party extensions:
  6. * Cython - incredibly popular in the numeric community, uses a language similar to Python with C level type
  7. annotations that directly compile to C. Can be used to extend Python types.
  8. * cffi - easy way to call C from Python without writing any C or learning a new language.
  9. However, if you feel you need to use the C API or you are working on the CPython implementation itself, this document
  10. will describe how to do it.
  11.