diff options
author | Volker Schroer <3470424+dl1ksv@users.noreply.github.com> | 2021-10-12 11:18:51 +0200 |
---|---|---|
committer | mormj <34754695+mormj@users.noreply.github.com> | 2021-10-27 14:29:53 -0400 |
commit | dae6e47c1858a3273bed0e7405a33f156f95ae7b (patch) | |
tree | 65d3e29a84c027c36aece8698410daf2726842b0 /grc/core/FlowGraph.py | |
parent | e79cc19b87a9976d1cb44a4c315b59cc90ebdbf8 (diff) |
grc: Dependent variables sometimes fail to evaluate
fixes #4788
fixes #5100
fixes #5108
Tested with the coresponding examples.
Now disabling or deleting the symbol_rate block in #4788 correctly
updates the depending blocks
Signed-off-by: Volker Schroer <3470424+dl1ksv@users.noreply.github.com>
Diffstat (limited to 'grc/core/FlowGraph.py')
-rw-r--r-- | grc/core/FlowGraph.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/grc/core/FlowGraph.py b/grc/core/FlowGraph.py index aa9b1e4c61..ad42371bb8 100644 --- a/grc/core/FlowGraph.py +++ b/grc/core/FlowGraph.py @@ -227,6 +227,10 @@ class FlowGraph(Element): def renew_namespace(self): namespace = {} + # Before renewing the namespace, clear it + # to get rid of entries of blocks that + # are no longer valid ( deleted, disabled, ...) + self.namespace.clear() # Load imports for expr in self.imports(): try: @@ -262,6 +266,9 @@ class FlowGraph(Element): pass namespace.update(np) # Merge param namespace + # We need the updated namespace to evaluate the variable blocks + # otherwise sometimes variable_block rewrite / eval fails + self.namespace.update(namespace) # Load variables for variable_block in self.get_variables(): try: @@ -275,9 +282,7 @@ class FlowGraph(Element): log.exception('Failed to evaluate variable block {0}'.format(variable_block.name), exc_info=True) pass - self.namespace.clear() self._eval_cache.clear() - self.namespace.update(namespace) def evaluate(self, expr, namespace=None, local_namespace=None): """ |