@@ -76,6 +76,7 @@ def __init__(self, parent):
76
76
self .active_sinks = [] # on rewrite
77
77
78
78
self .states = {'state' : True , 'bus_source' : False , 'bus_sink' : False , 'bus_structure' : None }
79
+ self .block_namespace = {}
79
80
80
81
if Flags .HAS_CPP in self .flags and self .enabled and not (self .is_virtual_source () or self .is_virtual_sink ()):
81
82
# This is a workaround to allow embedded python blocks/modules to load as there is
@@ -131,17 +132,18 @@ def rekey(ports):
131
132
self .active_sinks = [p for p in self .sinks if not p .hidden ]
132
133
133
134
# namespaces may have changed, update them
134
- self .block_namespace = {}
135
+ self .block_namespace .clear ()
136
+ imports = ""
135
137
try :
136
- exec (self .templates .render ('imports' ), self .block_namespace )
138
+ imports = self .templates .render ('imports' )
139
+ exec (imports , self .block_namespace )
137
140
except ImportError :
138
141
# We do not have a good way right now to determine if an import is for a
139
142
# hier block, these imports will fail as they are not in the search path
140
143
# this is ok behavior, unfortunately we could be hiding other import bugs
141
144
pass
142
145
except Exception :
143
- log .exception ('Failed to evaluate import expression "{0}"' .format (expr ), exc_info = True )
144
- pass
146
+ self .add_error_message (f'Failed to evaluate import expression { imports !r} ' )
145
147
146
148
def update_bus_logic (self ):
147
149
###############################
0 commit comments