Re: [Cython] [Pyrex] Casting python objects to void* and back
Greg Ewing <greg.ewing-F+z8Qja7x9Xokq/[email protected]> Fri, 23 May 2008 14:04:54 +1200
| Newsgroups | gmane.comp.python.cython.devel,gmane.comp.python.pyrex |
|---|---|
| Organization | University of Canterbury | Te Whare Wananga o Waitaha |
| Message-ID | <[email protected]> |
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