Skip to content

Commit

Permalink
Python3 compatibility: fix integer problems
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
jwessel authored and blp committed Jul 6, 2017
1 parent 4ab6656 commit fa145f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ovsdb/ovsdb-idlc.in
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ static void
print(" %s" % type.value.initCDefault(valueVar, type.n_min == 0))
print(" }")
else:
if type.n_max != sys.maxint:
if type.n_max != sys.maxsize:
print(" size_t n = MIN(%d, datum->n);" % type.n_max)
nMax = "n"
else:
Expand Down
2 changes: 2 additions & 0 deletions python/build/nroff.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ def fatal(msg):


def put_text(text, x, y, s):
x = int(x)
y = int(y)
extend = x + len(s) - len(text[y])
if extend > 0:
text[y] += ' ' * extend
Expand Down

0 comments on commit fa145f1

Please sign in to comment.