How to create a C Extension that uses CPython internals (outside limited API)?

Marco Sulla Marco.Sulla.Python at gmail.com
Wed Oct 21 09:32:49 EDT 2020


I'm working on a C extension for frozendict. To make it working, I had to:

1. add by hand the whole path of dictobject.c
(/home/marco/sources/cpython/Objects/dictobject.c)
2. add -DPy_BUILD_CORE
3. add the whole path of CPython includes
(/home/marco/sources/cpython/Include and so on)

This works on my machine, but I suspect that nobody will download the whole
CPython code and add the extra CFLAGS only to make it work.

What do I have to do? I have to copy the CPython source code that I need
inside my c extension folder? What if I also want to support CPython from
3.6 to 3.9?


More information about the Python-list mailing list