Fix infinite recursion when updating connected dict remotely

This commit is contained in:
Alex Burlacu 2023-06-16 13:52:55 +03:00
parent eede2b6155
commit 050d6d8970
2 changed files with 10 additions and 6 deletions

View File

@ -3673,14 +3673,14 @@ class Task(_Task):
# noinspection PyProtectedMember
task._arguments.copy_from_dict(flatten_dictionary(config_dict), prefix=name)
def _refresh_args_dict(task, config_dict):
def _refresh_args_dict(task, config_proxy_dict):
# reread from task including newly added keys
# noinspection PyProtectedMember
a_flat_dict = task._arguments.copy_to_dict(flatten_dictionary(config_dict), prefix=name)
a_flat_dict = task._arguments.copy_to_dict(flatten_dictionary(config_proxy_dict), prefix=name)
# noinspection PyProtectedMember
nested_dict = config_dict._to_dict()
config_dict.clear()
config_dict.update(nested_from_flat_dictionary(nested_dict, a_flat_dict))
nested_dict = config_proxy_dict._to_dict()
config_proxy_dict.clear()
config_proxy_dict._do_update(nested_from_flat_dictionary(nested_dict, a_flat_dict))
def _check_keys(dict_, warning_sent=False):
if warning_sent:

View File

@ -39,10 +39,14 @@ class ProxyDictPostWrite(dict):
return a_dict
def update(self, E=None, **F):
res = self._do_update(E, **F)
self._set_callback()
return res
def _do_update(self, E=None, **F):
res = super(ProxyDictPostWrite, self).update(
ProxyDictPostWrite(self._update_obj, self._set_callback, E) if E is not None else
ProxyDictPostWrite(self._update_obj, self._set_callback, **F))
self._set_callback()
return res