]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix two serious flake8 reports
authorTom Tromey <tromey@adacore.com>
Fri, 23 Feb 2024 18:52:40 +0000 (11:52 -0700)
committerTom Tromey <tromey@adacore.com>
Tue, 19 Mar 2024 16:07:59 +0000 (10:07 -0600)
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

index 47045518e6440e68d168f31e39b6b7a9584e9ddd..d774e194fba31f5dbc5f0427224c1c814e854057 100644 (file)
@@ -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