Skip to content

Commit

Permalink
增加TODO:挂载带有IL的配置树是,检查level是够超过子树根
Browse files Browse the repository at this point in the history
  • Loading branch information
HAL-42 committed Jul 29, 2024
1 parent 004f810 commit 9fe5796
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions alchemy_cat/py_tools/config/py_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,10 @@ def _setitem(self, key: Any, value: Any, /) -> None:
elif (value.get_attribute('__parent') is not None) or (value.get_attribute('__key') is not None):
self[key] = value.branch_copy()
value = self[key]
# TODO 此处有一个隐藏BUG:当该value含有DEP时,改DEP会被赋值过来。若该DEP是rel模式,则level很可能错乱。
# TODO 解决方案1:重算level和lambda:太复杂,做不到。
# TODO 解决方案2:拷贝过来的IL作为“分身”,不直接计算,等“真身”计算完后赋值:“真身”若来自其他树,可能不计算,不可信。
# TODO 解决方案3:安全检查,赋值过来的树里,如果有rel的DEP,如果其level超过了赋值树的顶层,则报错。
# -* 根子树挂载。
else:
value.set_attribute('__parent', self)
Expand Down

0 comments on commit 9fe5796

Please sign in to comment.