public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Fix two serious flake8 reports
Date: Tue, 19 Mar 2024 16:08:08 +0000 (GMT)	[thread overview]
Message-ID: <20240319160809.530293858CD1@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=12d5d5bfd0201711ac3b14d8cd92589919a82b7a

commit 12d5d5bfd0201711ac3b14d8cd92589919a82b7a
Author: Tom Tromey <tromey@adacore.com>
Date:   Fri Feb 23 11:52:40 2024 -0700

    Fix two serious flake8 reports
    
    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.

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/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

                 reply	other threads:[~2024-03-19 16:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240319160809.530293858CD1@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).