csp icon indicating copy to clipboard operation
csp copied to clipboard

csp.Struct doesnt support property setters

Open robambalu opened this issue 1 year ago • 0 comments

At the moment looks like csp.Struct wont properly process setattr calls when setting via a property, it wouild be very useful to get this to work.

Sample repro:

class S(csp.Struct):
    _a : int

    @property
    def a(self):
        return self._a

    @a.setter
    def a(self, x):
        self._a = x
s = S()
s.a = 1
Traceback (most recent call last):
  File "/home/ra7293/pycharm-community-2023.1.2/plugins/python-ce/helpers/pydev/pydevconsole.py", line 364, in runcode
    coro = func()
  File "<input>", line 1, in <module>
AttributeError: PyStruct.cpp:setattr:432:AttributeError: 'S' object has no attribute 'a'

robambalu avatar Mar 14 '24 19:03 robambalu