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

Pauli Virtanen pav@iki...
Sun Mar 21 17:08:35 CDT 2010


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.

-- 
Pauli Virtanen


More information about the NumPy-Discussion mailing list