[Pyrex] Re: callback
John J Lee
jjl at pobox.com
Mon Aug 18 14:24:49 CEST 2003
On Mon, 18 Aug 2003, Pedro Rodriguez wrote:
> On Mon, 18 Aug 2003 03:04:40 +0000, Bryan Weingarten wrote:
[...]
> > my problem is that the i need user data to be passed into status_callback
> > which gets passed back to the python callback. the "cheese" way of doing
[...]
> Instead of just passing the actual python callback, you can pass a python
> object that will hold all the data you need.
[...]
> But there may be still an issue here. I don't know if the 'data' tuple
> provided to the C code (set_status_callback) may be garbage collected.
> In that case, it may be required to prevent this by memorizing the last
> passed data at global level.
[...]
Or Py_INCREF instead, I suppose?
cdef extern from "Python.h":
void Py_INCREF(object)
void Py_DECREF(object)
void Py_XINCREF(object)
void Py_XDECREF(object)
John
More information about the Pyrex
mailing list