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

flag_override() may not always restore the original flags #589

Closed
odelalleau opened this issue Mar 9, 2021 · 1 comment · Fixed by #590
Closed

flag_override() may not always restore the original flags #589

odelalleau opened this issue Mar 9, 2021 · 1 comment · Fixed by #590
Labels
bug Something isn't working

Comments

@odelalleau
Copy link
Collaborator

Describe the bug

When restoring flags, flag_override() may accidentally restore flag inherited from the parent:

c = OmegaConf.create({"a": {"b": 1}})
print(f"Before: {c.a._get_flag('test')}")
with flag_override(c, "test", True):
    with flag_override(c.a, "test", False):
        print(f"During: {c.a._get_flag('test')}")
print(f"After: {c.a._get_flag('test')}")

Output:

Before: None
During: False
After: True  <== should be `None`!
@omry
Copy link
Owner

omry commented Mar 9, 2021

nice catch. #590.

@omry omry closed this as completed in #590 Mar 9, 2021
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.

2 participants