Ver código fonte

do not try to set constants from non scalar or list (#2256)

resolves #2212

Co-authored-by: Fred Lefévère-Laoide <Fred.Lefevere-Laoide@Taipy.io>
Fred Lefévère-Laoide 6 meses atrás
pai
commit
e4c34f8011
1 arquivos alterados com 3 adições e 2 exclusões
  1. 3 2
      taipy/gui/builder/_utils.py

+ 3 - 2
taipy/gui/builder/_utils.py

@@ -39,10 +39,11 @@ class _TransformVarToValue(ast.NodeTransformer):
         if var_parts[0] in self.non_vars:
             return node
         value = _get_value_in_frame(self.frame, var_parts[0])
-        if callable(value):
-            return node
         if len(var_parts) > 1:
             value = attrgetter(var_parts[1])(value)
+        if not isinstance(value, (str, int, float, bool, list, tuple)):
+            # transform into constants only what can be (ie not callable or generator for example)
+            return node
         return ast.Constant(value=value, kind=None)