[Cython] Best way to link in Cython utility code?

Stefan Behnel stefan_ml at behnel.de
Fri Dec 19 22:02:08 CET 2008


Dag Sverre Seljebotn wrote:
> For the refcount nanny, I have a file refcheck.pyx which exports several
> functions which is called from Cython-generated C code if a flag is set,
> to do the reference nannying (basically they are "filters" for Py_...REF
> calls, called (__Pyx_RefcheckerIncRef and so on).
> 
> Currently, I hack this to work by manually including "cimport refcheck" in
> my (single) testcase, and declare the functions as "api", leaving it to
> the Cython-specific protocol to do the "linking"/pointer retrieval. This
> give me what I need for developing it, but no more...

I'd try to use the .pxi include mechanism (somehow) from within Cython, to
get it into the same file.

Stefan



More information about the Cython-dev mailing list