public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix two serious flake8 reports
@ 2024-02-23 19:06 Tom Tromey
  2024-03-19 16:06 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2024-02-23 19:06 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix two serious flake8 reports
  2024-02-23 19:06 [PATCH] Fix two serious flake8 reports Tom Tromey
@ 2024-03-19 16:06 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2024-03-19 16:06 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

>>>>> "Tom" == Tom Tromey <tromey@adacore.com> writes:

Tom> flake8 points out that some code in frame_filters.py is referring to
Tom> undefined variables.

Tom> In the first hunk, I've changed the code to match what other
Tom> 'complete' methods do in this file.

Tom> In the second hunk, I've simply removed the try/except -- if
Tom> get_filter_priority fails, it will raise GdbError, which is already
Tom> handled properly by gdb.

I'm checking this in.

flake8 has pointed out some new errors, I'll send another fix for those.

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-19 16:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-23 19:06 [PATCH] Fix two serious flake8 reports Tom Tromey
2024-03-19 16:06 ` Tom Tromey

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).