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

Structured configs with Dict annotations allowing forbidden objects. #386

Closed
4 tasks done
pereman2 opened this issue Sep 22, 2020 · 0 comments · Fixed by #395
Closed
4 tasks done

Structured configs with Dict annotations allowing forbidden objects. #386

pereman2 opened this issue Sep 22, 2020 · 0 comments · Fixed by #395
Labels
bug Something isn't working
Milestone

Comments

@pereman2
Copy link
Contributor

Describe the bug
DictConfig with primitive type as element type is allowing other structured configs as a valid element.

To Reproduce

@dataclass
class A:
   pass
@dataclass
class C:
    foo: Dict[str, int] = field(default_factory=lambda: {"a": A()})

cfg = OmegaConf.structured(C) # Doesn't raise an error

Expected behaviour

It should raise an error when assigning structured configs to a different element type in DictConfigs.

context

  • OmegaConf version: 2.0.2
  • Python version: 3.6, 3.7 and 3.8
  • Operating system : mac
  • 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
2 participants