catch all exception types instead of only AttributeError

This commit is contained in:
2021-10-25 13:25:37 +02:00
parent e3246f9bd7
commit c294e4edb2

View File

@ -128,7 +128,7 @@ def format_type(obj):
tn = typename(obj)
try:
dtype = obj.dtype
except AttributeError:
except Exception: # Exception just in case something besides AttributeError is raised
return tn
else:
return f"{dtype} {tn}"
@ -136,7 +136,7 @@ def format_type(obj):
def format_size(obj):
try:
return obj.shape
except AttributeError:
except Exception: # Exception just in case something besides AttributeError is raised
try:
return len(obj)
except TypeError: