[Numpy-discussion] PyArray_FromAny() steals a reference to PyArray_Descr* dtype
Travis Oliphant
travis at continuum.io
Wed Feb 15 18:31:53 EST 2012
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: balarsen at lanl.gov
>
> Correspondence /
> Technical data or Software Publicly Available
>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120215/9b77387c/attachment.html>
More information about the NumPy-Discussion
mailing list