aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2024-03-19 11:11:05 -0600
committerTom Tromey <tromey@adacore.com>2024-04-02 10:58:37 -0600
commite2238b2e2061cffd2b7ae2894747205a56d2f775 (patch)
tree3e99acfdba6187b2ebc5ef8a05b9fd09926acbe9 /gdb
parent34b0776fd7385fcf1108981307d6d625f3565779 (diff)
downloadgdb-e2238b2e2061cffd2b7ae2894747205a56d2f775.zip
gdb-e2238b2e2061cffd2b7ae2894747205a56d2f775.tar.gz
gdb-e2238b2e2061cffd2b7ae2894747205a56d2f775.tar.bz2
Do not use bare "except"
flake8 warns about a bare "except". The docs point out that this will also catch KeyboardInterrupt and SystemExit exceptions, which is normally undesirable. Using "except Exception" catches everything reasonable, so this patch makes this change. Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb')
-rw-r--r--gdb/python/lib/gdb/__init__.py2
-rw-r--r--gdb/python/lib/gdb/styling.py6
2 files changed, 4 insertions, 4 deletions
diff --git a/gdb/python/lib/gdb/__init__.py b/gdb/python/lib/gdb/__init__.py
index 611d725..aae0d36 100644
--- a/gdb/python/lib/gdb/__init__.py
+++ b/gdb/python/lib/gdb/__init__.py
@@ -159,7 +159,7 @@ def _auto_load_packages():
reload(__import__(modname))
else:
__import__(modname)
- except:
+ except Exception:
sys.stderr.write(traceback.format_exc() + "\n")
diff --git a/gdb/python/lib/gdb/styling.py b/gdb/python/lib/gdb/styling.py
index 704c992..8e5d64f 100644
--- a/gdb/python/lib/gdb/styling.py
+++ b/gdb/python/lib/gdb/styling.py
@@ -39,7 +39,7 @@ try:
return highlight(contents, lexer, formatter).encode(
gdb.host_charset(), "backslashreplace"
)
- except:
+ except Exception:
return None
class HandleNasmComments(TokenMergeFilter):
@@ -70,7 +70,7 @@ try:
flavor = gdb.parameter("disassembly-flavor")
if flavor == "intel" and gdbarch.name()[:4] == "i386":
lexer_type = "nasm"
- except:
+ except Exception:
# If GDB is built without i386 support then attempting to fetch
# the 'disassembly-flavor' parameter will throw an error, which we
# ignore.
@@ -89,7 +89,7 @@ try:
lexer = __get_asm_lexer(gdbarch)
formatter = get_formatter()
return highlight(content, lexer, formatter).rstrip().encode()
- except:
+ except Exception:
return content
except ImportError: