You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: TYPE_setitem functions are broken in various ways #8902
UNICODE_setitem and STRING_setitem behave differently when __len__ fails
classbroken:
def__len__(self):
raiseValueError('no length')
def__repr__(self):
return'OK'def__getitem__(self, i):
return42u=np.array([u'test'])
u[0] =broken()
assertu[0] =='OK'b=np.array([b'test'])
b[0] =broken()
# ValueError: cannot set an array element with a sequence
Arguably the correct thing to do is just propagate the exception
UNICODE_setitem and STRING_setitem have a weird special cases for empty sequences:
s=np.array(["test"])
s[0] = []
asserts[0] =="[]"s[0] = [1]
# ValueError: setting an array element with a sequence
Activity
BUG: Don't call float when constructing longdouble arrays
ENH: Don't allow lists to become strings iff they are empty