Commits

Kazuhiko Shimada authored 04ec6ca8af7
CAS-14503: specified an argument to exec() to set scope
No tags

casatasks/src/private/casaxmlutil.py

Modified
147 147 else:
148 148 kwargs_[k] = v
149 149
150 150 if __DEBUG:
151 151 print(converter_function_string)
152 152 pprint(args_position_dict)
153 153 pprint(args_)
154 154
155 155 # override args by the converter generated from xml
156 156 casatasks.casalog.post('loaded constraints from XML', 'DEBUG')
157 - exec(converter_function_string)
158 - exec(f'{__FUNCTION}(args_, args_position_dict, supplied_args_flags)')
157 + _local = {}
158 + exec(converter_function_string, locals=_local)
159 + _local[__FUNCTION](args_, args_position_dict, supplied_args_flags)
159 160
160 161 # execute task
161 162 retval = func(*args_, **kwargs_)
162 163
163 164 return retval
164 165 return wrapper
165 166
166 167
167 168 def __get_taskxmlfilepath(task):
168 169 xmlpath = os.path.abspath(casatasks.__path__[0]) + '/__xml__'

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut