[Pyrex] Passing references to C "objects,structures,arrays,etc"

Greg Ewing greg at cosc.canterbury.ac.nz
Mon Sep 22 05:31:38 CEST 2003


> cdef extern from "Python.h":
>     void Py_INCREF(object)
>     void Py_DECREF(object)
>     void Py_XINCREF(object)
>     void Py_XDECREF(object)

I don't recommend that. You should always be able to get exactly the
same effect by storing a reference, and get it much more safely. Pyrex
is meant to free you from having to deal with refcounts explicitly!

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Pyrex mailing list