[Cython] Cython array type: Summary, introducing CEP 518
Dag Sverre Seljebotn
dagss at student.matnat.uio.no
Wed Jun 17 19:08:37 CEST 2009
Dag Sverre Seljebotn wrote:
> Dag Sverre Seljebotn wrote:
>> Robert Bradshaw wrote:
>>> On a related note, it's still a bit unclear how these things can be
>>> passed around and stored. Are they just a Py_buffer + PyObject*? (I'm
>>> hoping you're thinking they can be passed around and stored with
>>> ease, with allocation either take care of by the corresponding object
>>> (which will clean up the memory when it gets collected) or if there
>>> is no object attached, the user needs to treat it as they would a raw
>>> pointer).
>
> To really answer this, yes. Reference counting etc., it will just work
> like any other Python reference from the user's perspective, with the
> usual caveats of "<object>char_ptr".
>
Hmm. <object>char_ptr takes a copy I suppose though? So it's kind of
different, but at any rate deallocating C storage before a wrapping
array reference is destroyed is fatal. We could support
a = int[:,:](some_c_ptr, deallocator=stdlib.free)
though to transfer ownership.
--
Dag Sverre
More information about the Cython-dev
mailing list