Python Function pointer in C
Nick Coghlan
ncoghlan at email.com
Thu Nov 25 09:10:24 EST 2004
More information about the Python-list mailing list
Thu Nov 25 09:10:24 EST 2004
- Previous message (by thread): redirecting stderr
- Next message (by thread): Python Function pointer in C
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
David Gilbert wrote: > I'm trying to maintain the interface to KQueue for FreeBSD. At one > point, the C module stores an opaque object in a C structure such that > the opaque pointer can be used later by the application. In this case, a Py_IncRef/DecRef pair is definitely required - the 'borrowed' reference from the Python function call only lasts until the function returns. You need your own reference if you're going to hang on to the pointer. > How do I define "udata" such that I can stuff the lambda reference in > there? PyObject* should be fine so long as the references are handled correctly. > Now... I've wondered if this is a reference counting issue --- but > this still happens when I use the name of a module global function as > udata. I'd suggest adding the IncRef/DecRef pair and trying it out again. I can't see anything else obviously wrong in the fragments you've posted. If that was the sole problem though, I would have expected the same as you - for the module global function to work correctly. Sorry I can't be more help. . . Cheers, Nick.
- Previous message (by thread): redirecting stderr
- Next message (by thread): Python Function pointer in C
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list