rosidl_python
rosidl_python copied to clipboard
Fix int32[] and uint32[] 32 bit sequence types only accepting 16 bit sequences
I noticed this bug while reviewing #129. There is a bug with the types of int32[]
and uint32[]
message fields where 32 bit sequences are being stored in types that only accepts 16bit values. The tests look like they're covering this case, but actually they aren't because the comparison of array.array()
instances is not intuitive.
array.array()
comparisons don't consider typecode
>>> array.array('B') == array.array('f')
True
array.array()
comparisons seem to check equality of the sequences they were created with, not the bytes they output
>>> aI = array.array('I', [0, 1, 4294967295])
>>> aL = array.array('L', [0, 1, 4294967295])
>>> aI == aL
True
>>> aI.tobytes() == aL.tobytes()
False
This should be backported to Foxy and Galactic.