numpy/numpy — pull request #2798 by cgohlke (2012-12-07 23:17:05+00:00)
Title: ValueError: low level cast function is for unequal type numbers for object types

This was reported on the [numpy-discussion mailing list](http://comments.gmane.org/gmane.comp.python.numeric.general/52285).

The following code using np.object_ data types works with numpy 1.5.1 but fails with 1.6.2. Other data types, np.float64 for example, seem to work.

```
In [1]: import numpy as np

In [2]: np.array(['a'], dtype='O').astype(('O', [('name', 'O')]))
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in ()
----> 1 np.array(['a'], dtype='O').astype(('O', [('name', 'O')]))

ValueError: low level cast function is for unequal type numbers

In [3]: np.array([16], dtype='d').astype(('d', [('name', 'd')]))
Out[3]: array([ 16.])
```

These downstream issues could be related:
* http://code.google.com/p/h5py/issues/detail?id=217
* https://github.com/CellProfiler/CellProfiler/issues/421

I'm not entirely sure the proposed patch is correct/best, but it seems to fix this and the h5py issue.