[Cython] [Pyrex] Casting python objects to void* and back
Robert Bradshaw
robertwb at math.washington.edu
Fri May 23 04:38:39 CEST 2008
On May 22, 2008, at 7:04 PM, Greg Ewing wrote:
> Robert Bradshaw wrote:
>> At the end of the function, t is deallocated... You need to manually
>> Py_INCREF(t)
>
> Rather than manually increfing and decrefing, I'd recommend
> keeping an ordinary reference somewhere that you know will
> stay alive long enough, as it will be much less error prone.
> Manual refcounting should only be used as a last resort.
Yes, this is a much better way of keeping track of things.
- Robert
More information about the Cython-dev
mailing list