[Cython] Stealing/borrowed references semantics
Stefan Behnel
stefan_ml at behnel.de
Tue Jul 7 13:32:47 CEST 2009
Dag Sverre Seljebotn wrote:
> it would be syntax candy for an extra incref. I can work around
> this now by:
>
> cdef extern void Real_PyList_SET_ITEM "PyList_SET_ITEM"(object,
> Py_ssize_t, object)
>
> cdef inline void PyList_SET_ITEM(object a, Py_ssize_t b, object c):
> Py_INCREF(c)
> Real_PyList_SET_ITEM(a, b, c)
>
> For ~20 functions I am likely not going to bother; while simply declaring
>
> cdef extern void PyList_SET_ITEM(object, Py_ssize_t, stolen object):
I'm fine with that, as long as we only allow it inside of argument lists
(preferrably only "extern" argument lists).
Stefan
More information about the Cython-dev
mailing list