--- a/eric6/DebugClients/Python/DebugVariables.py Thu Apr 15 16:52:05 2021 +0200 +++ b/eric6/DebugClients/Python/DebugVariables.py Thu Apr 15 18:11:24 2021 +0200 @@ -52,11 +52,9 @@ d = {} for name in names: - try: + with contextlib.suppress(Exception): attribute = getattr(var, name) d[name] = attribute - except Exception: # secok - pass # if we can't get it, simply ignore it return d @@ -86,11 +84,9 @@ d = {} for name in names: - try: + with contextlib.suppress(Exception): attribute = getattr(var, name) d[name] = attribute - except Exception: # secok - pass # if we can't get it, simply ignore it yield -1, d while True: @@ -658,32 +654,28 @@ with contextlib.suppress(Exception): _TypeMap.append((long, None)) # __IGNORE_WARNING__ - try: + with contextlib.suppress(ImportError): import array _TypeMap.append((array.array, arrayResolver)) - except ImportError: - pass # array.array may not be available + # array.array may not be available - try: + with contextlib.suppress(ImportError): import numpy _TypeMap.append((numpy.ndarray, ndarrayResolver)) - except ImportError: - pass # numpy may not be installed + # numpy may not be installed - try: + with contextlib.suppress(ImportError): from django.utils.datastructures import MultiValueDict # it should go before dict _TypeMap.insert(0, (MultiValueDict, multiValueDictResolver)) - except ImportError: - pass # django may not be installed + # django may not be installed - try: + with contextlib.suppress(ImportError): from collections.abc import ItemsView, KeysView, ValuesView _TypeMap.append((ItemsView, dictViewResolver)) _TypeMap.append((KeysView, dictViewResolver)) _TypeMap.append((ValuesView, dictViewResolver)) - except ImportError: - pass # not available on all Python versions + # not available on all Python versions def getType(obj):