[Pyrex] Borrowed references

Daniele Varrazzo daniele.varrazzo at gmail.com
Sat Jul 29 22:27:21 UTC 2006


Just a question:

when i import a Python API function returning a borrowed reference such as:

    PyObject* PyTuple_GetItem(PyObject *p, int pos)

do i have to import  it as:

cdef extern from "Python.h":
    void *PyTuple_GetItem(object, int)

or

cdef extern from "Python.h":
    object PyTuple_GetItem(object, int)

???

Reading the generated C code, the latter form seems to leave an extra
refcount, doesn't it?

If so, maybe the issue deserves more attention in the documentation.
Or did i miss it?

Daniele

P.S. Pyrex is white magic...



More information about the Pyrex mailing list