With PyTango 8.1.6 (built without numpy due to bug #704) I have problems with float arguments that have values <= 0. With the PowerSupply server example from the quick tour doc, and this client:
import PyTango
dp = PyTango.DeviceProxy('test/test/test')
dp.current = 1
print dp.current
dp.current = 0
print dp.current
I get an OverflowError on the second "print dp.current":
Traceback (most recent call last):
File "client.py", line 5, in <module>
dp.current = 0
File "/usr/lib64/python2.7/site-packages/PyTango/device_proxy.py", line 223, in __DeviceProxy__setattr
self.write_attribute(name, value)
File "/usr/lib64/python2.7/site-packages/PyTango/green.py", line 165, in greener
ret = submit(fn, self, *args, **kwargs)
File "/usr/lib64/python2.7/site-packages/PyTango/green.py", line 81, in synch_submit
return get_synch_executor().submit(fn, *args, **kwargs)
File "/usr/lib64/python2.7/site-packages/PyTango/green.py", line 73, in submit
return fn(*args, **kwargs)
File "/usr/lib64/python2.7/site-packages/PyTango/device_proxy.py", line 981, in __DeviceProxy__write_attribute
return self._write_attribute(*args, **kwargs)
OverflowError: Value is too small.
The same error also appears when calling commands that take or return float or float array arguments. It does not appear when building with numpy.
Looking at the source of the exception, I noticed that in src/boost/cpp/fast_from_py.h, in the definition of DEFINE_FAST_TANGO_FROMPY_NUM there is a difference between the Numpy and non-Numpy cases: the non-Numpy case does not check for TangoScalarTypeLimits::is_integer.
I can confirm this bug (same version).
Here is a simple device server to reproduce it:
Confirmed.
When not using numpy, the range check is done for double types.
Unfortunately, the std::numeric_limits<t>::min() returns the minimum integer when T=int/long but in case of float/double returns the smallest positive.</t>
The test is now similar to what is done in case of having numpy and the problem should be fixed.
Will become visible in next PyTango 8.1.7
Thanks for reporting
Just one more thing:
Bug #704 should now be fixed so you when you build next PyTango 8.1.7 I really recommend enabling numpy.
Thanks!