[ovs-dev,33/55] python: Don't compare None and int.
diff mbox

Message ID 1450730875-18083-34-git-send-email-russell@ovn.org
State Deferred
Headers show

Commit Message

Russell Bryant Dec. 21, 2015, 8:47 p.m. UTC
Comparing None to an integer worked in Python 2, but fails in Python 3.

Signed-off-by: Russell Bryant <russell@ovn.org>
---
 python/ovs/reconnect.py | 2 +-
 tests/test-reconnect.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Patch
diff mbox

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 4ff95ae..3b68819 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: