spacepaste

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