[Numpy-discussion] Another reference count leak: ticket #848

Travis E. Oliphant oliphant@enthought....
Tue Jul 8 17:46:32 CDT 2008


Michael Abbott wrote:
> On Tue, 8 Jul 2008, Travis E. Oliphant wrote:
>   
>> Michael Abbott wrote:
>>     
>>> The attached patch fixes another reference count leak in the use of 
>>> PyArray_DescrFromType.
>>>   
>>>       
>> The first part of this patch is good.  The second is not needed.   
>>     
> I don't see that.  The second part of the patch addresses the case of an 
> early return: this means that the DECREF that occurs later on in the code 
> is bypassed, and so a reference leak will still occur if this early return 
> case occurs.  Don't forget that PyArray_DescrFromType returns an 
> incremented reference that has to be decremented, returned or explicitly 
> assigned -- the DECREF obligation has to be met somewhere.
>   

Don't forget that PyArray_FromAny consumes the reference even if it 
returns with an error.

-Travis



More information about the Numpy-discussion mailing list