Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignment of invalid value to ListConfig modifies the value. #433

Closed
4 tasks done
pereman2 opened this issue Nov 8, 2020 · 0 comments · Fixed by #434
Closed
4 tasks done

Assignment of invalid value to ListConfig modifies the value. #433

pereman2 opened this issue Nov 8, 2020 · 0 comments · Fixed by #434
Labels
bug Something isn't working

Comments

@pereman2
Copy link
Contributor

pereman2 commented Nov 8, 2020

Describe the bug
Assigning a list with invalid values to a ListConfig keeps the content modified after raising the error.
To Reproduce

    @dataclass
    class ListClass:
        list: List[int] = field(default_factory=lambda: [1])
    cfg = OmegaConf.structured(ListClass)
    try:
        cfg.list = [1, 2, "foo"]
    except:
        pass
    print(cfg.list) # output [1, 2]

Expected behavior
cfg.list should return to be [1]
Additional context

  • OmegaConf version: 2.1.0
  • Python version: 3.8
  • Operating system : macOS
  • Please provide a minimal repro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant