Skip to content

Commit

Permalink
Closes omry#1087.
Browse files Browse the repository at this point in the history
This PR addresses an edge-case where `AssertionError` is raised during a
call to `OmegaConf.unsafe_merge`.

This PR is marked as a draft:
- I haven't written tests yet
- I'm not sure if this is the best approach to solving the issue.
  • Loading branch information
Jasha10 committed Jun 11, 2023
1 parent 85b3892 commit 0667739
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion omegaconf/basecontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,12 @@ def _set_item_impl(self, key: Any, value: Any) -> None:
if isinstance(value, Node):
do_deepcopy = not self._get_flag("no_deepcopy_set_nodes")
if not do_deepcopy and isinstance(value, Box):
# Detect the special case where value has no root:
value_has_root = (
isinstance(value, Container) or value._get_parent() is not None
)
# if value is from the same config, perform a deepcopy no matter what.
if self._get_root() is value._get_root():
if value_has_root and self._get_root() is value._get_root():
do_deepcopy = True

if do_deepcopy:
Expand Down

0 comments on commit 0667739

Please sign in to comment.