blob: d6f93646f9f6bd83c5814528f854285fd4edb75a [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001From d22c7f1c6ade82a0cd646cfcd8df9adda6cd1ad6 Mon Sep 17 00:00:00 2001
Brad Bishopd7bf8c12018-02-25 22:55:05 -05002From: Jason Wessel <jason.wessel@windriver.com>
3Date: Thu, 29 Jun 2017 20:33:23 -0700
Brad Bishop316dfdd2018-06-25 12:45:53 -04004Subject: [PATCH] Python3 compatibility: fix integer problems
Brad Bishopd7bf8c12018-02-25 22:55:05 -05005
6Commit fa145f1a53943243f94a32ce98525db8494b0052 from
7https://github.com/openvswitch/ovs.git
8
9In python3 maxint is not defined, but maxsize is defined in both
10python2 and python3.
11
12The put_text() will not automatically use a value which came in as
13float due to a pior math function and python3 will throw an exception.
14The simple answer is to convert it with int() and move on.
15
16Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
17Signed-off-by: Ben Pfaff <blp@ovn.org>
Brad Bishop316dfdd2018-06-25 12:45:53 -040018
Brad Bishopd7bf8c12018-02-25 22:55:05 -050019---
20 ovsdb/ovsdb-idlc.in | 2 +-
21 python/build/nroff.py | 2 ++
22 2 files changed, 3 insertions(+), 1 deletion(-)
23
24diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
Brad Bishop316dfdd2018-06-25 12:45:53 -040025index b70a599..3645275 100755
Brad Bishopd7bf8c12018-02-25 22:55:05 -050026--- a/ovsdb/ovsdb-idlc.in
27+++ b/ovsdb/ovsdb-idlc.in
28@@ -358,7 +358,7 @@ static void
29 print(" %s" % type.value.initCDefault(valueVar, type.n_min == 0))
30 print(" }")
31 else:
32- if type.n_max != sys.maxint:
33+ if type.n_max != sys.maxsize:
34 print(" size_t n = MIN(%d, datum->n);" % type.n_max)
35 nMax = "n"
36 else:
37diff --git a/python/build/nroff.py b/python/build/nroff.py
38index c23837f..401f699 100644
39--- a/python/build/nroff.py
40+++ b/python/build/nroff.py
41@@ -148,6 +148,8 @@ def fatal(msg):
42
43
44 def put_text(text, x, y, s):
45+ x = int(x)
46+ y = int(y)
47 extend = x + len(s) - len(text[y])
48 if extend > 0:
49 text[y] += ' ' * extend