From patchwork Fri Feb 23 19:06:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 86305 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BE5DD385842A for ; Fri, 23 Feb 2024 19:07:15 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by sourceware.org (Postfix) with ESMTPS id 346C93858CD1 for ; Fri, 23 Feb 2024 19:06:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 346C93858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 346C93858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::132 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708715214; cv=none; b=xTfaaESLAquraerGaVlg7cQZGEzpiuNl0LFmWxz+eUV5sG7hn5vW9sTjUKCcqDLMwAsKU8QmBTwZaJxiq+r1FulQwIYTRZk2cL4FqNtjXn4Nqnm/vlr4SIyhyN3GaVzkIVUz2mlVKb6I7bDjcYZ3cEkY26LOlBr4ABox+/CSfV8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708715214; c=relaxed/simple; bh=REf9XHPJBKpz0OQu4W2SZ3FFlm5lXDzzw7wuHnd44WE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=C7RIDsI3PyKDICsCksgpzPQFmDufCpIigeKAxxTjwN7CdqDajZ4FomwvT2v4z7OnDrzzryh6cMJCoDEYkapdHMHZesIXG+A32eVL8ST/hHQ8x/k89An0muMjUSoAEIQACNY4WdloF+HKIr3cqkTfvGmrBppxW/DUWANpfPQePeE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-il1-x132.google.com with SMTP id e9e14a558f8ab-36576b35951so3375575ab.3 for ; Fri, 23 Feb 2024 11:06:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1708715211; x=1709320011; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=WDJxUVjvJeamQs3eEG4ZjFIfdbfjXm4Epnk/bHu2wYk=; b=knX2sYshoUqTV0S8hIMa/m5rtoNbUZyfzAB0cBZgKm+X6uKtWWfiDSwphBjs8ORYye DL1ZlTYd8emJyN0x6Ps3Zj/Zye2gV1NZpNmpA5xJlz2fXmjIIzk/gCH0EFdXeBcwYNfp 6t12EQJwVo6uS9msIigo5U4yjZVgo6C9e1xmcH0Irdswo+7DjX13rGz1ZqiNSQzqRveA VtxfjfFBYxX/e0o2np/9HdmSwwvvF3R8cIyzrHholMpQAZgdupv9x1V9v1VMrOg8Ooz6 ffsLtLXhU5Q2H2v4BMZFhmC9PavRKzlZcFnsnAvDdPCvF4u/gKd/dRPFCU1QrfgjtcbS frUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708715211; x=1709320011; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WDJxUVjvJeamQs3eEG4ZjFIfdbfjXm4Epnk/bHu2wYk=; b=o8fAPe9pZNXGNQn+VXUaSnLCavcQTAWhLuCqcluc4apNHjXPey5thHRj6DLIeR/3JZ 2OvIadCLQwXo480uirPYImj3YoVkhE6BLsqN3scXv8fFKr3VXT+Kks88YcKZTAxDk3Iz VYr4huKf8pimyVtkF0Gr8PhHTVlmVA3CpC6ogDO1G6g28wKczKJ6G9BcFForzBuM45gS Qa6W0YPfWlN3MnC3cDSkPICDUhB5Ii9dxkzAG/DqoVUierVMReO/OmV9UxOhBaDvOSsD 0SUFqafa/6VI1B0WhtzN3h3wyz1AEA0QpvF2AykfVS4qUIRZQ159j7uvt21eonzdPIit zb+g== X-Gm-Message-State: AOJu0YwMHXsloO9oa6S+Dgg0CWVPnDoOFBJeggZyY52T9k2NfYpdB9j0 P/NwjqC6hm6qshh+ERm41QzpZdbN75ljkov5VqzC/9QqOfEehqiVipUJTzB5uBiqUanCPIqrJ+0 = X-Google-Smtp-Source: AGHT+IEktMoXXD4yTNRbOE0dXFoEBBXKaK5ibSmRsdgyjYvDf2Ga2kUP9Or+uU2bbrb0LBXoZw4ooQ== X-Received: by 2002:a05:6e02:13e8:b0:365:a00:d9c0 with SMTP id w8-20020a056e0213e800b003650a00d9c0mr835024ilj.18.1708715211423; Fri, 23 Feb 2024 11:06:51 -0800 (PST) Received: from localhost.localdomain (71-211-170-195.hlrn.qwest.net. [71.211.170.195]) by smtp.gmail.com with ESMTPSA id bq5-20020a056e02238500b003653138d6e5sm3167382ilb.88.2024.02.23.11.06.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 11:06:51 -0800 (PST) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Fix two serious flake8 reports Date: Fri, 23 Feb 2024 12:06:41 -0700 Message-ID: <20240223190641.3662803-1-tromey@adacore.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org flake8 points out that some code in frame_filters.py is referring to undefined variables. In the first hunk, I've changed the code to match what other 'complete' methods do in this file. In the second hunk, I've simply removed the try/except -- if get_filter_priority fails, it will raise GdbError, which is already handled properly by gdb. --- gdb/python/lib/gdb/command/frame_filters.py | 25 +++++++++------------ 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/gdb/python/lib/gdb/command/frame_filters.py b/gdb/python/lib/gdb/command/frame_filters.py index 47045518e64..d774e194fba 100644 --- a/gdb/python/lib/gdb/command/frame_filters.py +++ b/gdb/python/lib/gdb/command/frame_filters.py @@ -445,7 +445,7 @@ class ShowFrameFilterPriority(gdb.Command): if text.count(" ") == 0: return _complete_frame_filter_list(text, word, False) else: - printer_list = frame._return_list(text.split()[0].rstrip()) + printer_list = gdb.frames.return_list(text.split()[0].rstrip()) return _complete_frame_filter_name(word, printer_list) def invoke(self, arg, from_tty): @@ -454,20 +454,15 @@ class ShowFrameFilterPriority(gdb.Command): return filter_name = command_tuple[1] list_name = command_tuple[0] - try: - priority = self.get_filter_priority(list_name, filter_name) - except Exception: - e = sys.exc_info()[1] - print("Error printing filter priority for '" + name + "':" + str(e)) - else: - print( - "Priority of filter '" - + filter_name - + "' in list '" - + list_name - + "' is: " - + str(priority) - ) + priority = self.get_filter_priority(list_name, filter_name) + print( + "Priority of filter '" + + filter_name + + "' in list '" + + list_name + + "' is: " + + str(priority) + ) # Register commands