From: Russell Bryant Date: Thu, 17 Dec 2015 14:56:44 +0000 (-0500) Subject: python: Don't compare None and int. X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=c03afda69ae8b1be9d3d94ded0e1c12f6e886dba python: Don't compare None and int. Comparing None to an integer worked in Python 2, but fails in Python 3. Signed-off-by: Russell Bryant Acked-by: Ben Pfaff --- diff --git a/python/ovs/reconnect.py b/python/ovs/reconnect.py index 39dd556da..d4f59518f 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 e291e3435..8132fd925 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: