[Numpy-discussion] reference leaks in array() and arange()

Lisandro Dalcin dalcinl at gmail.com
Thu Aug 2 20:01:43 EDT 2007


As PyArray_DescrConverter return new references, I think there could
be many places were PyArray_Descr* objects get its reference count
incremented.

Here, I send a patch correcting this for array() and arange(), but not
sure if this is the more general solution.

BTW, please see my previous comments in previous mail on using
convertor functions (returning new refs) and the (very common) idiom
"if(!PyArg_PaseXXX(,,,) return NULL", as this seems to be used in
almost all places in numpy C sources and is a potential source of ref
leaks.

Regards,

-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
-------------- next part --------------
A non-text attachment was scrubbed...
Name: array-arange.patch
Type: application/octet-stream
Size: 1229 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070802/5a2ffeae/attachment.obj>


More information about the NumPy-Discussion mailing list