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

Lisandro Dalcin dalcinl at gmail.com
Sat Dec 20 16:33:19 CET 2008


Dag, sorry about my complete ignorance. This refcounting nanny is
supposed to be a tool for Cython developement and testing, or rather a
general mechanism for Cython-generated extension modules?


On Sat, Dec 20, 2008 at 8:25 AM, Dag Sverre Seljebotn
<dagss at student.matnat.uio.no> wrote:
> Stefan Behnel wrote:
>> 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.
>
> Could be done. However there's a problem: I wouldn't like the refcont
> nanny itself to be refcount nannied, to avoid infinite loops.
>
> I suppose I can put in locks to (rather easily) overcome this, still
> compiling the refcount nanny in a seperate stage with different flags
> and linking it in seems rather more elegant *shrug*.
>
> --
> Dag Sverre
> _______________________________________________
> Cython-dev mailing list
> Cython-dev at codespeak.net
> http://codespeak.net/mailman/listinfo/cython-dev
>



-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594


More information about the Cython-dev mailing list