rosidl_python icon indicating copy to clipboard operation
rosidl_python copied to clipboard

Fix int32[] and uint32[] 32 bit sequence types only accepting 16 bit sequences

Open sloretz opened this issue 3 years ago • 2 comments

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.

sloretz avatar May 22 '21 04:05 sloretz