On Jul 6, 2009, at 11:45 AM, Dag Sverre Seljebotn wrote:

> In updating numpy.pxd, I encountered the issue that there are  
> exceptions
> from the standard refcounting rules (this also applies somewhere in
> CPython, e.g. PyList_SET_ITEM/GET_ITEM).
>
> Is there a way of declaring such functions in extern blocks, e.g.
> something like
>
> cdef extern borrowed object PyList_GET_ITEM(object, Py_ssize_t)
> cdef extern void PyList_SET_ITEM(object, Py_ssize_t, borrowed object)
>
> If not, should I make a ticket for it? (Just wondering what workflow I
> should assign to numpy.pxd; I don't have time for implementing this.)

The convention we've taken in Sage is that borrowed references are  
declared as PyObject* (so to store them anywhere requires casting to  
object, thus an incref). When you say "borrowed" for an argument, I'm  
assuming you mean arguments that steal references, right? I agree it  
might be useful to have something there.

- Robert

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to