[Biopython-dev] [Bug 2251] [PATCH] NumPy support for BioPython

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Thu Sep 25 11:51:13 UTC 2008


http://bugzilla.open-bio.org/show_bug.cgi?id=2251





------- Comment #16 from biopython-bugzilla at maubp.freeserve.co.uk  2008-09-25 07:51 EST -------
We will also need to deal with the deprecation of the following
functions in numpy 1.2, which will be removed in numpy 1.3:

PyArray_FromDims to PyArray_SimpleNew.
PyArray_FromDimsAndDataAndDescr to PyArray_NewFromDescr

Quoting the numpy CAPI.txt file (thanks Bruce!),

------ start quote -------

``PyArray_SimpleNew(nd, dims, typenum)`` is a drop-in replacement
 for ``PyArray_FromDims`` (except it takes ``npy_intp*`` dims
instead of ``int*`` dims which matters on 64-bit systems) and it
does not initialize the memory to zero.

``PyArray_SimpleNew`` is just a macro for ``PyArray_New`` with
default arguments.  Use ``PyArray_FILLWBYTE(arr, 0)``  to fill
with zeros.

The ``PyArray_FromDims`` and family of functions are still
available and are loose wrappers around this function.  These
functions still take ``int *`` arguments.  This should be fine
on 32-bit systems, but on 64-bit systems you may run into
trouble if you frequently passed ``PyArray_FromDims`` the
dimensions member of the old ``PyArrayObject`` structure
because ``sizeof(npy_intp) != sizeof(int)``.

------ end quote -------

Here is a recent example of dealing with this - switching part
of scipy and how the pointer issue complicates things:

http://projects.scipy.org/pipermail/scipy-dev/2008-August/009581.html
http://scipy.org/scipy/scipy/ticket/723

See also
http://scipy.org/scipy/numpy/ticket/805


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the Biopython-dev mailing list