From patchwork Mon Dec 21 20:47:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell Bryant X-Patchwork-Id: 559730 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 0140D140BB2 for ; Tue, 22 Dec 2015 07:54:48 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 7BF611075C; Mon, 21 Dec 2015 12:48:43 -0800 (PST) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id DDACD10759 for ; Mon, 21 Dec 2015 12:48:39 -0800 (PST) Received: from bar5.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id 689761E00FF for ; Mon, 21 Dec 2015 13:48:39 -0700 (MST) X-ASG-Debug-ID: 1450730919-09eadd632dc67c0001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar5.cudamail.com with ESMTP id 1uWlJa4Zj0oFWi7w (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 21 Dec 2015 13:48:39 -0700 (MST) X-Barracuda-Envelope-From: russell@ovn.org X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO mx1.redhat.com) (209.132.183.28) by mx1-pf2.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 21 Dec 2015 20:48:38 -0000 Received-SPF: neutral (mx1-pf2.cudamail.com: 209.132.183.28 is neither permitted nor denied by SPF record at ovn.org) X-Barracuda-Apparent-Source-IP: 209.132.183.28 X-Barracuda-RBL-IP: 209.132.183.28 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 3519AC0B7E13; Mon, 21 Dec 2015 20:48:38 +0000 (UTC) Received: from x1c.redhat.com ([10.3.112.11]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBLKm0du002018; Mon, 21 Dec 2015 15:48:37 -0500 X-CudaMail-Envelope-Sender: russell@ovn.org From: Russell Bryant To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-E2-1220082832 X-CudaMail-DTE: 122115 X-CudaMail-Originating-IP: 209.132.183.28 Date: Mon, 21 Dec 2015 15:47:33 -0500 X-ASG-Orig-Subj: [##CM-E2-1220082832##][PATCH 33/55] python: Don't compare None and int. Message-Id: <1450730875-18083-34-git-send-email-russell@ovn.org> In-Reply-To: <1450730875-18083-1-git-send-email-russell@ovn.org> References: <1450730875-18083-1-git-send-email-russell@ovn.org> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1450730919 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Subject: [ovs-dev] [PATCH 33/55] python: Don't compare None and int. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" Comparing None to an integer worked in Python 2, but fails in Python 3. Signed-off-by: Russell Bryant --- 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 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: