fredrik at pythonware.com
Fri Jun 20 10:32:38 CEST 2003
vincent wehren wrote:
> Yes, that was my guess too...
> So I did someting along the lines of:
> pos = PyCObject_FromVoidPtr(pos_blk; NULL) ;
> return Py_BuildValue("N", pos);
> Passing is back in where I was getting trouble:
> ( passed back in via PyArg_ParseTuple(args, "O", pos) )
> pos_blk = PyCObjectAsVoidPtr(pos);
> doesn't seem to work...
better make that:
PyArg_ParseTuple(args, "O", &pos)
also, the CObject approach only works if someone else is main-
taining the pos_blk memory for you (CObject won't magically hold
on to the memory, and won't release it for you when you're done)
if you need to maintain your own memory buffer, using a string
or a custom type is a much more reliable solution.
More information about the Python-list