python: Don't compare None and int.
authorRussell Bryant <russell@ovn.org>
Thu, 17 Dec 2015 14:56:44 +0000 (09:56 -0500)
committerRussell Bryant <russell@ovn.org>
Tue, 2 Feb 2016 21:42:21 +0000 (16:42 -0500)
Comparing None to an integer worked in Python 2, but fails in Python 3.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
python/ovs/reconnect.py
tests/test-reconnect.py

index 39dd556..d4f5951 100644 (file)
@@ -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):
index e291e34..8132fd9 100644 (file)
@@ -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: