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

With a List[int] config option (structured config), a single integer is still parsed as an integer #300

Closed
odelalleau opened this issue Jul 14, 2020 · 1 comment · Fixed by #312
Labels
bug Something isn't working

Comments

@odelalleau
Copy link
Collaborator

odelalleau commented Jul 14, 2020

This is a copy of facebookresearch/hydra#758 moved to OmegaConf as per @omry 's request.

The following code runs fine while it should raise an error since fudge is supposed to be a list of integers, not an integer.

from dataclasses import dataclass, field
from typing import List
from omegaconf import OmegaConf

@dataclass
class Config:
    fudge: List[int] = field(default_factory=lambda: [])

cfg = OmegaConf.structured(Config)

cfg.fudge = 1
@omry
Copy link
Owner

omry commented Jul 14, 2020

Thanks for reporting!

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