You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug OmegaConf.structured(...) mutates its input when called on a dataclass or dataclass instance that has a structured DictConfig instance as one of its fields.
To Reproduce
fromdataclassesimportdataclassfromomegaconfimportOmegaConf@dataclassclassUser:
name: str="Bond"age: int=7@dataclassclassHasUser:
user: Userhas_user1=OmegaConf.structured(HasUser(User()))
asserthas_user1.user._parentishas_user1has_user2=OmegaConf.structured(HasUser(has_user1.user))
asserthas_user2.user._parentishas_user2asserthas_user1.user._parentisNone# has_user1.user has been mutatedasserthas_user1.userisnothas_user2.user
Expected behavior
The creation of has_user2 should not mutate has_user1.user.
Most OmegaConf creation and assignment methods do not mutate their inputs.
Additional context
OmegaConf version: latest dev version (main branch)
The text was updated successfully, but these errors were encountered:
Describe the bug
OmegaConf.structured(...)
mutates its input when called on a dataclass or dataclass instance that has a structuredDictConfig
instance as one of its fields.To Reproduce
Expected behavior
The creation of
has_user2
should not mutatehas_user1.user
.Most OmegaConf creation and assignment methods do not mutate their inputs.
Additional context
main
branch)The text was updated successfully, but these errors were encountered: