From patchwork Sat May 4 10:25:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Terekhov, Mikhail via Gdb-patches" X-Patchwork-Id: 32542 Received: (qmail 64359 invoked by alias); 4 May 2019 10:25:18 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 64327 invoked by uid 89); 4 May 2019 10:25:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=HDKIM-Filter:v2.11.0, H*UA:x64, H*UA:Win64 X-HELO: mail.tambre.ee Received: from mail.tambre.ee (HELO mail.tambre.ee) (172.104.135.62) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 04 May 2019 10:25:13 +0000 To: gdb-patches@sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 mail.tambre.ee BE5245F82C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tambre.ee; s=201812; t=1556965509; bh=uEkfUnzlN+YKdL86sTLpzlghac0/PFSmOI5roxOb8OU=; h=To:From:Subject:Date:From; b=pYPWEgIskf8QEcbfEMp/sD1GmSMSzIqmqz7kKwyOwrbepUZNJ4O+C9ZCJD3BMykTp fU8BC4gzKo/wLeeDYHQyJG1L3byL0MRm8hHHc5bSKCKaJcmtHG77z1SasrLc7RmCIZ +BVmYAC6aSjoMYHFdkSGVg+46B9CSjqSGxz8tMHe6B0AC99xARQz25CytS0QoHXZR9 dT74giKUxFUwsgmp/eEfAiOEfItVfKqLFdZIHYTOclxFdrN1HcYOviW6InWxOey9th SnZMWkpSrSX7jMs6wrr9Dy/XFKWDZ5P5jwO3kM4LUDjE7wYNLIQ2FGPavdrD/GmhV6 ENNXKnv5GMjQw== X-Patchwork-Original-From: "Raul Tambre via gdb-patches" From: "Terekhov, Mikhail via Gdb-patches" Reply-To: Raul Tambre Subject: [PATCH] Fix incorrect use of 'is' operator for comparison in python/lib/gdb/command/prompt.py Message-ID: <7c5b3290-fb75-20b0-08e4-c8cb305d9c4c@tambre.ee> Date: Sat, 4 May 2019 13:25:06 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 Noticed this while searching for similar issues in the Chromium codebase. Hopefully I managed to format the patch correctly. Fix incorrect use of 'is' operator for comparison in python/lib/gdb/command/prompt.py The 'is' operator is not meant to be used for comparisons. It currently working is an implementation detail of CPython. CPython 3.8 has added a SyntaxWarning for this. gdb/ChangeLog: 2019-05-04 Raul Tambre * python/lib/gdb/prompt.py: Fix incorrect use of 'is' operator for comparison. --- gdb/python/lib/gdb/command/prompt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdb/python/lib/gdb/command/prompt.py b/gdb/python/lib/gdb/command/prompt.py index 3d662a7d..04b9e49c 100644 --- a/gdb/python/lib/gdb/command/prompt.py +++ b/gdb/python/lib/gdb/command/prompt.py @@ -45,7 +45,7 @@ The currently defined substitutions are: self.hook_set = False def get_show_string (self, pvalue): - if self.value is not '': + if self.value: return "The extended prompt is: " + self.value else: return "The extended prompt is not set." @@ -57,7 +57,7 @@ The currently defined substitutions are: return "" def before_prompt_hook(self, current): - if self.value is not '': + if self.value: return gdb.prompt.substitute_prompt(self.value) else: return None