Wrong logic in set_complex_value

Our set_complex_value at least does not work for (str,) attributes, when we return tuple of strings:

from tango.server import Device, attribute
from tango.test_context import DeviceTestContext


class TestDevice(Device):

    @attribute(dtype=(str,), max_dim_x=3)
    def attr(self):
        return ("a", "b", "c")


if __name__ == "__main__":
    with DeviceTestContext(TestDevice) as proxy:
        print(proxy.attr)

result in:

tango._tango.DevFailed: DevFailed[
    DevError[
        desc = TypeError: _set_value_date_quality(): incompatible function arguments. The following argument types are supported:
                1. (self: tango._tango.Attribute, arg0: object, arg1: float, arg2: tango._tango.AttrQuality) -> None
                2. (self: tango._tango.Attribute, arg0: object, arg1: object, arg2: float, arg3: tango._tango.AttrQuality) -> None

            Invoked with: Attribute(attr), 'a', 'b', 'c'
        origin = Traceback (most recent call last):
              File "/home/matveyev/pytango/tango/server.py", line 124, in read_attr
                set_complex_value(attr, ret)
              File "/home/matveyev/pytango/tango/utils.py", line 439, in set_complex_value
                attr.set_value_date_quality(*value)
              File "/home/matveyev/pytango/tango/device_server.py", line 312, in __Attribute__set_value_date_quality
                self._set_value_date_quality(*args)
            TypeError: _set_value_date_quality(): incompatible function arguments. The following argument types are supported:
                1. (self: tango._tango.Attribute, arg0: object, arg1: float, arg2: tango._tango.AttrQuality) -> None
                2. (self: tango._tango.Attribute, arg0: object, arg1: object, arg2: float, arg3: tango._tango.AttrQuality) -> None

            Invoked with: Attribute(attr), 'a', 'b', 'c'
        reason = PyDs_PythonError
        severity = ERR
    ],
Edited Jul 03, 2025 by Anton Joubert
Assignee Loading
Time tracking Loading