Skip to content

Commit e726a4c

Browse files
committed
QwtInterval: avoid overflows with NumPy scalars
Related to PlotPyStack/guiqwt#49
1 parent c9faeb3 commit e726a4c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

qwt/interval.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class QwtInterval(object):
3838
def __init__(self, minValue=0., maxValue=-1., borderFlags=None):
3939
assert not isinstance(minValue, QwtInterval)
4040
assert not isinstance(maxValue, QwtInterval)
41-
self.__minValue = minValue
42-
self.__maxValue = maxValue
41+
self.__minValue = float(minValue) # avoid overflows with NumPy scalars
42+
self.__maxValue = float(maxValue) # avoid overflows with NumPy scalars
4343
if borderFlags is None:
4444
self.__borderFlags = self.IncludeBorders
4545
else:
@@ -53,8 +53,8 @@ def setInterval(self, minValue, maxValue, borderFlags):
5353
:param float maxValue: Maximum value
5454
:param int borderFlags: Include/Exclude borders
5555
"""
56-
self.__minValue = minValue
57-
self.__maxValue = maxValue
56+
self.__minValue = float(minValue) # avoid overflows with NumPy scalars
57+
self.__maxValue = float(maxValue) # avoid overflows with NumPy scalars
5858
self.__borderFlags = borderFlags
5959

6060
def setBorderFlags(self, borderFlags):
@@ -85,15 +85,15 @@ def setMinValue(self, minValue):
8585
8686
:param float minValue: Minimum value
8787
"""
88-
self.__minValue = minValue
88+
self.__minValue = float(minValue) # avoid overflows with NumPy scalars
8989

9090
def setMaxValue(self, maxValue):
9191
"""
9292
Assign the upper limit of the interval
9393
9494
:param float maxValue: Maximum value
9595
"""
96-
self.__maxValue = maxValue
96+
self.__maxValue = float(maxValue) # avoid overflows with NumPy scalars
9797

9898
def minValue(self):
9999
"""

0 commit comments

Comments
 (0)