[Pyrex] [Cython]  Casting python objects to void* and back
    Greg Ewing 
    greg.ewing at canterbury.ac.nz
       
    Fri May 23 04:04:54 CEST 2008
    
    
  
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.
-- 
Greg
    
    
More information about the Pyrex
mailing list