eric6/Debugger/VariablesViewer.py

branch
maintenance
changeset 8576
fe1957c69854
parent 8450
be7369a19dc9
parent 8530
db1794734aec
diff -r d0123f020daa -r fe1957c69854 eric6/Debugger/VariablesViewer.py
--- a/eric6/Debugger/VariablesViewer.py	Sat Jul 03 11:47:48 2021 +0200
+++ b/eric6/Debugger/VariablesViewer.py	Sat Sep 04 11:34:54 2021 +0200
@@ -192,6 +192,7 @@
             else:
                 dvalue = VariableItem.unsized
             self.hasChildren = True
+        
         elif dtype in VariableItem.arrayTypes:
             self.childCount = int(dvalue)
             dvalue = VariableItem.noOfItemsStr.format(dvalue)
@@ -211,22 +212,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
         
@@ -443,6 +446,7 @@
                     child.value = newItem.value
                     child.valueShort = newItem.valueShort
                     child.tooltip = newItem.tooltip
+                    child.nameWithId = newItem.nameWithId
                     
                     child.currentCount = -1
                     child.populated = False

eric ide

mercurial