Closed feltech closed 1 month ago
We already have the following code in place
if not isinstance({{ VarName }}, {{ VarType }}):
raise TypeError("{{ property.id }} must be a '{{ VarType }}'.")
self.__data.setTraitProperty(self.kId, "{{ property.id }}", {{ VarName }}
I confirmed this works fine to ensure you can't set a float
trait property with an int
value.
However, it is possible to set a bool
value on an int
property. Perhaps the description in the issue had the wrong type?
I'll update the description.
What
Python
int
trait properties can easily be set tobool
values without realising. The internalstd::variant
would then store the value as abool
, potentially causing problems accessing the value from C++.ACs