toml icon indicating copy to clipboard operation
toml copied to clipboard

Bug: failed to parse mixed types in Array

Open nycnighthawk opened this issue 3 years ago • 3 comments

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.

nycnighthawk avatar Nov 24 '20 22:11 nycnighthawk

Maybe try:

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

??

tripleo1 avatar Dec 05 '20 11:12 tripleo1

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.

nycnighthawk avatar Dec 05 '20 19:12 nycnighthawk

I believe there is another bug which says this behavior should be added as per a newer version of the spec.

#324

On Sat, Dec 5, 2020 at 2:22 PM Han Chen [email protected] wrote:

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.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/uiri/toml/issues/341#issuecomment-739342673, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL73FM4JP5UB2OPCCNXUUNTSTKB7VANCNFSM4UBPLHWA .

tripleo1 avatar Dec 05 '20 19:12 tripleo1