Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp894069ybb; Fri, 20 Mar 2020 09:48:08 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvQfpfMuMspoT2FymciVwbdxJK/y4yfVEFrkeECPGRk7/+wGyF96gK9RWmol+qczf3ybjwg X-Received: by 2002:aca:3507:: with SMTP id c7mr7354567oia.147.1584722888056; Fri, 20 Mar 2020 09:48:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584722888; cv=none; d=google.com; s=arc-20160816; b=MWmSs1LHvZDjwvDRLIilN1JonNbFdkyYM+GdLbAMOTFjp+dMlBNrUb/3jFYUZql9Pa ZYAsFlHPZVUi7i86dAtv4N8DBOtbmXpXghve3+9876hCbwjhitgZQxFt2m2G8dJyuJWZ X4kfyUjYCZ+yihN3dNqJ04G7KoBImELKzIOO9vEShJHNXoR3PxLlpT8sKqCSYrzKTDh6 0ZFbebWWw9Rq2cAhvQsqOjGKVjmmVhiwF5ol/mbn0oTrt1+kPwr1h/BVzcnMCkRp+rN6 F9jzNn6vgfyKjYAZwfWC8pBHu940HDHZ1zXn/scAHuHpHjyaa97oo7LrvH56osvaynCX /hUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:to:subject:reply-to :dkim-signature; bh=Fe7K1h4TPcnPFZu14GV08/G9XSgsWYgeOJkC5RCLtuU=; b=Fa2Frq4shoK1Um+NvI+qWV2HHMT8cjQ82oo9GaiSdaaB3vJlDTrPMU77nWIqX8RiLw oth2eGv5tmIxoK/oi4jSLAywmoa9f+GbHkYSsjGUyS+e0O0FhC8OQEsYxTzkfJu6SS1I pTgr/EG9UfrqI7TR+A/0ZVoLwt5BVQ0k5uYgfEhgOc9L4GJ6kB/WlbPEMRnSR1VjI1np MtSXN3CrGN6sHFaeOSL53Z9ckLgfMitLyGmJ+P0iQR9UbrntoWl1mCCXfosxGefJpkEa EQCpo0QGiCy20hadV2PQQ/bN+VuVwws080rQALoNgZpKhtuW28kFKCr8xFA7I2k54ahk lOnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CYnBrLOQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q13si3319632otn.141.2020.03.20.09.47.49; Fri, 20 Mar 2020 09:48:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CYnBrLOQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727469AbgCTQrY (ORCPT + 99 others); Fri, 20 Mar 2020 12:47:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:33970 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727120AbgCTQrX (ORCPT ); Fri, 20 Mar 2020 12:47:23 -0400 Received: from [192.168.0.20] (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 28CC520739; Fri, 20 Mar 2020 16:47:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584722842; bh=Y4A7+22xQdNMp0esVoMRO58Zdq9+geN3sMcOwqpZWWQ=; h=Reply-To:Subject:To:References:From:Date:In-Reply-To:From; b=CYnBrLOQiRv5+xM3Uocc8HDf6jRRjc3kkta6Uo9+w3QFTn9LCulGNknpwK3RLP4gR bysGLkBRjUewZ20vZG39k7ljocaIR/VIOsXxIk5kR2sSOuBOy5HofXVi5XbqRq22+Z aPqqyOGinf4mrfD2DAddfv+e9l/gXgUoz++NPSZA= Reply-To: kbingham@kernel.org Subject: Re: [PATCH] scripts/gdb: replace "is 0" by "== 0" To: Vincent Bernat , Jan Kiszka , Stephen Boyd , linux-kernel@vger.kernel.org References: <20200320163820.3634106-1-vincent@bernat.ch> From: Kieran Bingham Openpgp: preference=signencrypt Autocrypt: addr=kbingham@kernel.org; keydata= mQINBFYE/WYBEACs1PwjMD9rgCu1hlIiUA1AXR4rv2v+BCLUq//vrX5S5bjzxKAryRf0uHat V/zwz6hiDrZuHUACDB7X8OaQcwhLaVlq6byfoBr25+hbZG7G3+5EUl9cQ7dQEdvNj6V6y/SC rRanWfelwQThCHckbobWiQJfK9n7rYNcPMq9B8e9F020LFH7Kj6YmO95ewJGgLm+idg1Kb3C potzWkXc1xmPzcQ1fvQMOfMwdS+4SNw4rY9f07Xb2K99rjMwZVDgESKIzhsDB5GY465sCsiQ cSAZRxqE49RTBq2+EQsbrQpIc8XiffAB8qexh5/QPzCmR4kJgCGeHIXBtgRj+nIkCJPZvZtf Kr2EAbc6tgg6DkAEHJb+1okosV09+0+TXywYvtEop/WUOWQ+zo+Y/OBd+8Ptgt1pDRyOBzL8 RXa8ZqRf0Mwg75D+dKntZeJHzPRJyrlfQokngAAs4PaFt6UfS+ypMAF37T6CeDArQC41V3ko lPn1yMsVD0p+6i3DPvA/GPIksDC4owjnzVX9kM8Zc5Cx+XoAN0w5Eqo4t6qEVbuettxx55gq 8K8FieAjgjMSxngo/HST8TpFeqI5nVeq0/lqtBRQKumuIqDg+Bkr4L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x0Fg2BSlLvLvXM0vU8pQk3kgDu7kb/7PRYrZvB sr21EIQoIjXbZxDz/o7z95frkP71EaICttZ6k9q5oxxA5WC6sTXcMW8zs8avFNuA9VpXt0Yu pJd2ijtZy2mpZNG02fFVXhIn4G807G7+9mhuC4XG5rKlBBUXTvPUAfYnB4JBDLmLzBFavQfv onSfbitgXwCG3vS+9HEwAjU30Bar1PEOmIbiAoMzuKeRm2LVpmq4WZw01QYHU/GUV/zHJSFk Message-ID: <55dae299-a5a0-6e11-c966-1d8dcb46c452@kernel.org> Date: Fri, 20 Mar 2020 16:47:19 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <20200320163820.3634106-1-vincent@bernat.ch> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Vincent, On 20/03/2020 16:38, Vincent Bernat wrote: > While for small numbers, using "node is 0" works with CPython, it is > more portable to use "node == 0". Moreover, with Python 3, this > triggers a syntax warning: Oh, I thought python encouraged the 'is' style. > > SyntaxWarning: "is" with a literal. Did you mean "=="? Of course that means it clearly doesn't in this case... > Signed-off-by: Vincent Bernat Change looks acceptable to me given the report, though a potential alternative below, otherwise Reviewed-by: Kieran Bingham > --- > scripts/gdb/linux/rbtree.py | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/scripts/gdb/linux/rbtree.py b/scripts/gdb/linux/rbtree.py > index 39db889b874c..87d4738984d2 100644 > --- a/scripts/gdb/linux/rbtree.py > +++ b/scripts/gdb/linux/rbtree.py > @@ -17,7 +17,7 @@ def rb_first(root): > raise gdb.GdbError("Must be struct rb_root not {}".format(root.type)) > > node = root['rb_node'] > - if node is 0: > + if node == 0: Given the nature of the statement, would if not node: return None be any more appropriate ? > return None > > while node['rb_left']: > @@ -33,7 +33,7 @@ def rb_last(root): > raise gdb.GdbError("Must be struct rb_root not {}".format(root.type)) > > node = root['rb_node'] > - if node is 0: > + if node == 0: > return None > > while node['rb_right']: > -- -- Kieran