eric6/Debugger/VariablesViewer.py

changeset 8472
52e96cd0730d
parent 8434
a105f31ba10f
child 8483
11469e50910f
--- a/eric6/Debugger/VariablesViewer.py	Sun Jul 18 12:23:03 2021 +0200
+++ b/eric6/Debugger/VariablesViewer.py	Sun Jul 18 14:28:27 2021 +0200
@@ -211,22 +211,24 @@
             dvalue.endswith(("}", ")", "]"))
         ):
             # it is most probably a dict, tuple or list derived class
-            value = ast.literal_eval(dvalue)
-            valueTypeStr = str(type(value))[8:-2]
-            if valueTypeStr in VariableItem.arrayTypes:
-                self.childCount = len(value)
-                self.hasChildren = True
+            with contextlib.suppress(Exception):
+                value = ast.literal_eval(dvalue)
+                valueTypeStr = str(type(value))[8:-2]
+                if valueTypeStr in VariableItem.arrayTypes:
+                    self.childCount = len(value)
+                    self.hasChildren = True
         
         elif (
             (dvalue.endswith("})") and "({" in dvalue) or
             (dvalue.endswith("])") and "([" in dvalue)
         ):
             # that is probably a set derived class
-            value = ast.literal_eval(dvalue.split("(", 1)[1][:-1])
-            valueTypeStr = str(type(value))[8:-2]
-            if valueTypeStr in VariableItem.arrayTypes:
-                self.childCount = len(value)
-                self.hasChildren = True
+            with contextlib.suppress(Exception):
+                value = ast.literal_eval(dvalue.split("(", 1)[1][:-1])
+                valueTypeStr = str(type(value))[8:-2]
+                if valueTypeStr in VariableItem.arrayTypes:
+                    self.childCount = len(value)
+                    self.hasChildren = True
         
         self.value = dvalue
         

eric ide

mercurial