[Numpy-discussion] numpy CAPI questions

Lane Brooks lbrooks@MIT....
Sun Oct 19 16:52:50 CDT 2008

Robert Kern wrote:
> On Sun, Oct 19, 2008 at 14:28, Lane Brooks <lbrooks@mit.edu> wrote:
>> 2. Is my reference counting correct?  Do I need to call the
>> PyArray_INCREF() on img?
> Personally, I always need to double-check my refcounting with
> sys.getrefcount() (which, it should be noted, adds its own reference,
> so the correct result for sys.getrefcount(foo()) should be 1). In your
> actual code, do you have anything else in the Py_BuildValue()? If you
> don't, then you don't need to use Py_BuildValue(); you can just return
> img.

Thanks for the great tip on sys.getrefcount().  I understand reference 
counting a whole lot better now after playing with sys.getrefcount() 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20081019/e3925172/attachment.html 

More information about the Numpy-discussion mailing list