[ovs-dev] [PATCH 09/11] python: Don't compare None and int.
Russell Bryant
russell at ovn.org
Sat Jan 23 02:32:31 UTC 2016
Comparing None to an integer worked in Python 2, but fails in Python 3.
Signed-off-by: Russell Bryant <russell at ovn.org>
---
python/ovs/reconnect.py | 2 +-
tests/test-reconnect.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/python/ovs/reconnect.py b/python/ovs/reconnect.py
index 39dd556..d4f5951 100644
--- a/python/ovs/reconnect.py
+++ b/python/ovs/reconnect.py
@@ -518,7 +518,7 @@ class Reconnect(object):
"""Causes the next call to poller.block() to wake up when self.run()
should be called."""
timeout = self.timeout(now)
- if timeout >= 0:
+ if timeout is not None and timeout >= 0:
poller.timer_wait(timeout)
def timeout(self, now):
diff --git a/tests/test-reconnect.py b/tests/test-reconnect.py
index e291e34..8132fd9 100644
--- a/tests/test-reconnect.py
+++ b/tests/test-reconnect.py
@@ -93,7 +93,7 @@ def do_advance(arg):
def do_timeout(_):
global now
timeout = r.timeout(now)
- if timeout >= 0:
+ if timeout is not None and timeout >= 0:
print(" advance %d ms" % timeout)
now += timeout
else:
--
2.5.0
More information about the dev
mailing list