Allow assignment of float convertible types to RealObject.
@@ -664,8 +664,11 @@ class RealObject(ModifiableObject):
TypeError: If target has an unsupported type for
real value assignment.
"""
- if not isinstance(value, float):
- self._log.critical("Unsupported type for real value assignment: %s (%s)", type(value), repr(value))
+ try:
+ value = float(value)
+ except ValueError:
+ self._log.critical("Unsupported type for real value assignment: %s (%s)" %
+ (type(value), repr(value)))
raise TypeError("Unable to set simulator value with type %s" % (type(value)))
simulator.set_signal_val_real(self._handle, value)
