(self, name: str, value: Any)
| 116 | return super().__getattribute__(name) |
| 117 | |
| 118 | def __setattr__(self, name: str, value: Any) -> None: |
| 119 | # accessing a structure field? |
| 120 | if name in _fields: |
| 121 | field = cls.__dict__[name] |
| 122 | ftype = _fields[name] |
| 123 | |
| 124 | # transform value into field bytes and write them to memory |
| 125 | fvalue = ftype(*value) if hasattr(ftype, '_length_') else ftype(value) |
| 126 | data = bytes(fvalue) |
| 127 | |
| 128 | mem.write(address + field.offset, data) |
| 129 | |
| 130 | # proceed to set the value to the structure in order to maintain consistency with ctypes.Structure |
| 131 | |
| 132 | # set attribute value |
| 133 | super().__setattr__(name, value) |
| 134 | |
| 135 | return VolatileStructRef() |
| 136 |
no test coverage detected