[7/9] Specify ImportError in styling.py

Message ID 20240319-more-flake8-v1-7-893549dbed75@adacore.com
State New
Headers
Series Make gdb/python flake-clean |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed

Commit Message

Tom Tromey March 19, 2024, 5:33 p.m. UTC
  styling.py has a long try/except surrounding most of the body.  flake8
warns about the final bare "except".  However, this except is really
only there to catch the situation where the host doesn't have Pygments
installed.  This patch changes this to only catch ImportError.
---
 gdb/python/lib/gdb/styling.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/gdb/python/lib/gdb/styling.py b/gdb/python/lib/gdb/styling.py
index 9608b5e2048..704c9926c29 100644
--- a/gdb/python/lib/gdb/styling.py
+++ b/gdb/python/lib/gdb/styling.py
@@ -92,7 +92,7 @@  try:
         except:
             return content
 
-except:
+except ImportError:
 
     def colorize(filename, contents):
         return None