mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
Python3 compatibility: fix integer problems
In python3 maxint is not defined, but maxsize is defined in both python2 and python3. The put_text() will not automatically use a value which came in as float due to a pior math function and python3 will throw an exception. The simple answer is to convert it with int() and move on. Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
@@ -358,7 +358,7 @@ static void
|
|||||||
print(" %s" % type.value.initCDefault(valueVar, type.n_min == 0))
|
print(" %s" % type.value.initCDefault(valueVar, type.n_min == 0))
|
||||||
print(" }")
|
print(" }")
|
||||||
else:
|
else:
|
||||||
if type.n_max != sys.maxint:
|
if type.n_max != sys.maxsize:
|
||||||
print(" size_t n = MIN(%d, datum->n);" % type.n_max)
|
print(" size_t n = MIN(%d, datum->n);" % type.n_max)
|
||||||
nMax = "n"
|
nMax = "n"
|
||||||
else:
|
else:
|
||||||
|
@@ -148,6 +148,8 @@ def fatal(msg):
|
|||||||
|
|
||||||
|
|
||||||
def put_text(text, x, y, s):
|
def put_text(text, x, y, s):
|
||||||
|
x = int(x)
|
||||||
|
y = int(y)
|
||||||
extend = x + len(s) - len(text[y])
|
extend = x + len(s) - len(text[y])
|
||||||
if extend > 0:
|
if extend > 0:
|
||||||
text[y] += ' ' * extend
|
text[y] += ' ' * extend
|
||||||
|
Reference in New Issue
Block a user