Relative Content

Tag Archive for pythonc++cython

Cython: Protecting a cdef class if __init__ is not called

I’m wrapping some Fortran/C codes with Cython. The __init__ method of my cdef class allocates some memory in C. I believe that this memory allocation has to happen in the __init__ method instead of the __cinit__ method because the allocation depends on inputs to __init__ (e.g. an input file).