DevEncoded attributes broken
The issue is linked to #501 (closed), but I think it's worth to make a separate issue in order to track it and to warn users.
If the return value for DevEncoded is not stored after the end of reading - it very likely will be corrupted during transmission. E.g.:
from tango import AttrWriteType, DevEncoded, GreenMode
from tango.server import Device, attribute
from tango.test_context import DeviceTestContext
NUM_BYTES = 99
class TestDevice(Device):
@attribute(dtype=DevEncoded, access=AttrWriteType.READ)
def attr_encoded(self):
return "example", str(''.join(['a' for _ in range(NUM_BYTES)]))
with DeviceTestContext(TestDevice) as proxy:
print(proxy.attr_encoded)
At my PC for NUM_BYTES = 9 gives:
('example', b'values\x00y\x00')
while for NUM_BYTES = 99:
('example', b'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
We have to solve the problem with ref.counts, but up to now it is not clear how to do it....