From c294e4edb2572e90e9a3392448f3f90927665d80 Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Mon, 25 Oct 2021 13:25:37 +0200 Subject: [PATCH] catch all exception types instead of only AttributeError --- inspector.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inspector.py b/inspector.py index 47023a2..46b34d9 100644 --- a/inspector.py +++ b/inspector.py @@ -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: