QUERY · ISSUE
bytearray slice assignment fails for derived types
docs
The type check for slice assignment to bytearray derived types seems to be a bit too strict:
class MyBytearray(bytearray): pass
a = MyBytearray(4)
b = MyBytearray(4)
a[0:4] = b
results in this error:
Traceback (most recent call last):
File "test.py", line 5, in <module>
NotImplementedError: array/bytes required on right side
CANDIDATE · PULL REQUEST
py: Fixed case where shifting a memory view right corrupts the contents
py-core
The following snippet (added to the tests) demonstrates the failure:
b = bytearray(b'0123456789')
m = memoryview(b)
m[1:] = m[:-1]
print(m == b'0012345678')
The errant behaviour was observed on a PYBV11 but works fine on the
unix port.
Fixes #6244