From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 530293858CD1; Tue, 19 Mar 2024 16:08:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 530293858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1710864489; bh=eNsRl/stcZgcJimclOYuQ+hoF6oC85nu40Q92RulwfU=; h=From:To:Subject:Date:From; b=pa+PoELJhk0cB2ueC4BvB4rlplpSN4JJXnelaXzo3hSpyQSeywVmNdWmQPncktjNm fsehuce2cyBVWwGTv3uNyhsoD1j9BqlG/ZZjLmQ4FPT79FWXOUHMEhH4U7dPpM1LvJ S2oXSsBnv4ZRZpV022Y8Nvo+WQr5auqG7j+xLRPM= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Fix two serious flake8 reports X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 52ca06e807be411af8cdfeafbe36a86e26c628af X-Git-Newrev: 12d5d5bfd0201711ac3b14d8cd92589919a82b7a Message-Id: <20240319160809.530293858CD1@sourceware.org> Date: Tue, 19 Mar 2024 16:08:08 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D12d5d5bfd020= 1711ac3b14d8cd92589919a82b7a commit 12d5d5bfd0201711ac3b14d8cd92589919a82b7a Author: Tom Tromey Date: Fri Feb 23 11:52:40 2024 -0700 Fix two serious flake8 reports =20 flake8 points out that some code in frame_filters.py is referring to undefined variables. =20 In the first hunk, I've changed the code to match what other 'complete' methods do in this file. =20 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. Diff: --- 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/g= db/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(" ") =3D=3D 0: return _complete_frame_filter_list(text, word, False) else: - printer_list =3D frame._return_list(text.split()[0].rstrip()) + printer_list =3D gdb.frames.return_list(text.split()[0].rstrip= ()) return _complete_frame_filter_name(word, printer_list) =20 def invoke(self, arg, from_tty): @@ -454,20 +454,15 @@ class ShowFrameFilterPriority(gdb.Command): return filter_name =3D command_tuple[1] list_name =3D command_tuple[0] - try: - priority =3D self.get_filter_priority(list_name, filter_name) - except Exception: - e =3D sys.exc_info()[1] - print("Error printing filter priority for '" + name + "':" + s= tr(e)) - else: - print( - "Priority of filter '" - + filter_name - + "' in list '" - + list_name - + "' is: " - + str(priority) - ) + priority =3D self.get_filter_priority(list_name, filter_name) + print( + "Priority of filter '" + + filter_name + + "' in list '" + + list_name + + "' is: " + + str(priority) + ) =20 =20 # Register commands