Yes, the PyArray_FromAny steals a reference to the dtype object.   This is done 
so you can build one on the fly doing something like  
PyArray_DescrFromType(NPY_DOUBLE)  inline with the PyArray_FromAny call. 

-Travis



On Feb 15, 2012, at 4:23 PM, Larsen, Brian A wrote:

> Hello all, 
> 
> the docs are unclear as to the reference counting on the inputs to the numpy 
> C function PyArray_FromAny().
> 
> multiarraymodule.c in the PyArray_InnerProduct() code seems to imply that a 
> reference to dtype is stolen in the PyArray_FromAny process.  Meaning that I 
> don't need/can't have a Py_DECREF().
> 
> Can anyone confirm this?
> 
> Thanks much, 
> 
> Brian
> 
> 
> 
> 
> 
> 
> 
> -- 
> 
> Brian A. Larsen
> ISR-1 Space Science and Applications
> Los Alamos National Laboratory
> PO Box 1663, MS-D466
> Los Alamos, NM 87545
> USA
> 
> (For overnight add:
> SM-30, Bikini Atoll Road)
> 
> Phone: 505-665-7691
> Fax:   505-665-7395
> email: [email protected]
> 
> Correspondence /
> Technical data or Software Publicly Available
> 
> 
> 
> _______________________________________________
> NumPy-Discussion mailing list
> [email protected]
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to