[Numpy-discussion] numpy CAPI questions
Sun Oct 19 16:52:50 CDT 2008
Robert Kern wrote:
> On Sun, Oct 19, 2008 at 14:28, Lane Brooks <email@example.com> 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
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...
More information about the Numpy-discussion