Closed
Description
In NumPy 1.10.1, this works:
>>> import numpy as np
>>> np.linalg.norm(np.array([np.array([0, 1]), 0, 0], dtype=object))
array([ 0., 1.])
In NumPy 1.11.0, however, it raises an exception:
>>> import numpy as np
>>> np.linalg.norm(np.array([np.array([0, 1]), 0, 0], dtype=object))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/numpy/linalg/linalg.py", line 2116, in norm
x = x.astype(float)
ValueError: setting an array element with a sequence.
Probably this
if not issubclass(x.dtype.type, inexact):
x = x.astype(float)
should be changed to
if not issubclass(x.dtype.type, (inexact, object_)):
x = x.astype(float)
?
Does that make sense?
If yes, I can make a PR.