From 08e22e9bee15ec760f38ec6deedb07972b7b97e3 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Sat, 27 Apr 2019 22:19:55 +0100 Subject: [PATCH] Fix up some terrible code where we caught all exceptions. --- development/pdbconv.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/development/pdbconv.py b/development/pdbconv.py index 117067ba4..0e57cbb61 100644 --- a/development/pdbconv.py +++ b/development/pdbconv.py @@ -121,6 +121,9 @@ class PDBConvertor: def lookup_ctype_pointers(self, ctype_pointer: str) -> Dict[str, Union[str, Dict[str, str]]]: base_type = ctype_pointer.replace('32P', '').replace('64P', '') + if base_type == ctype_pointer: + # We raise a KeyError, because we've been asked about a type that isn't a pointer + raise KeyError self._seen_ctypes.add(base_type) return {"kind": "pointer", "subtype": {"kind": "base", "name": base_type}} @@ -259,10 +262,10 @@ class PDBConvertor: if isinstance(kind, str): try: output = self.lookup_ctype_pointers(kind) - except: + except KeyError: try: output = {'kind': 'base', 'name': self.lookup_ctype(kind)} - except: + except KeyError: output = {'kind': 'base', 'name': kind} elif kind.leaf_type == 'LF_MODIFIER': output = self._format_kind(kind.modified_type)