[Numpy-discussion] Array bug with character (regression from 1.4.0)

Charles R Harris charlesr.harris at gmail.com
Sun Mar 21 18:13:27 EDT 2010


On Sun, Mar 21, 2010 at 4:08 PM, Pauli Virtanen <pav at iki.fi> wrote:

> Ryan May wrote:
> > The following code, which works with numpy 1.4.0, results in an error:
>
> Python 2.6, I presume?
>
> > In [1]: import numpy as np
> > In [2]: v = 'm'
> > In [3]: dt = np.dtype('>c')
> > In [4]: a = np.asarray(v, dt)
> >
> > On SVN trunk:
> > ValueError: assignment to 0-d array
> >
> > In [5]: np.__version__
> > Out[5]: '2.0.0.dev8297'
> >
> > Thoughts?
>
> Nope, but it's likely my bad. Smells a bit like the dtype '>c' has size 0
> that doesn't get automatically adjusted in the array constructor, so you end
> up assigning size-1 string to size-0 array element... Which is strange sice
> I don't think this particular code path has been changed at all.
>
> One would have to follow the C execution path with gdb to find out what
> goes wrong.
>
>
I was wondering if this was related to Michael's fixes for character arrays?
A little bisection might help localize the problem.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100321/8b32a45a/attachment.html>


More information about the NumPy-Discussion mailing list