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

Bug: failed to parse mixed types in Array #341

Open
nycnighthawk opened this issue Nov 24, 2020 · 3 comments
Open

Bug: failed to parse mixed types in Array #341

nycnighthawk opened this issue Nov 24, 2020 · 3 comments
Labels
type: feature A self-contained enhancement or new feature

Comments

@nycnighthawk
Copy link

See repl snippet to reproduce

>>> import toml
>>> x1 = """
... test = [1, "a"]
... """
>>> toml.loads(x1)

Per toml v1.0.0-rc3 spec, values of different types may be mixed.

@tripleo1
Copy link

tripleo1 commented Dec 5, 2020 via email

@nycnighthawk
Copy link
Author

Maybe try:

import toml>>> x1 = """... [section]
... test = [1, "a"]... """>>> toml.loads(x1) ??

I don't know if you actually tried your code. I got an exception and toml.decoder.TomlDecodeError: Not a homogeneous array ...

The exception clearly indicates that the error was due to array types are not the same. Per spec, it should be supported. So it has nothing to do with grouping the data inside another key section as suggested. You would get the same error. I checked the master branch decoder.py and the exception is still there when it tries to decode the array.

I used yaml instead to work around this instead of toml. The issue is certainly there.

@tripleo1
Copy link

tripleo1 commented Dec 5, 2020 via email

@pradyunsg pradyunsg added the type: feature A self-contained enhancement or new feature label Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature A self-contained enhancement or new feature
Projects
None yet
Development

No branches or pull requests

3 participants