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

Error when parsing table of arrays of tables of arrays of tables of tables where the lowest array has multiple entries #115

Closed
jmholla opened this issue Aug 4, 2017 · 1 comment

Comments

@jmholla
Copy link

jmholla commented Aug 4, 2017

Here's an example of such a toml file:

[[a]]
    [[a.b]]
        [a.b.c]
            d = "val0"
    [[a.b]]
        [a.b.c]
            d = "val1"

The library has no problem producing the toml output from a python object constructed like so, but on attempting to parse it, it errors with "An implicitly defined table can't be an array". That does not seem to be the case in this file.

Removing one layer of table/array allows it to be read.

To be fair, the TOML to JSON tool I usually use to validate my TOML doesn't work correctly with this eiither: https://toml-to-json.matiaskorhonen.fi/, but I can't find anything in the spec that should limit this use case.

Here's that same toml input being dumped from a python object and then loaded.

import toml

toml_dict = { # TABLE
    "a": [ # ARRAY
        { # TABLE
            "b": [ # ARRAY
                { # TABLE
                    "c": {"d": "val0"}  # TABLE
                },
                { # TABLE
                    "c": {"d": "val1"}  # TABLE
                }
            ]
        }
    ]
}

toml.loads(toml.dumps(toml_dict))
@uiri
Copy link
Owner

uiri commented Aug 28, 2017

Thank you for the bug report! I've fixed this and also added a regression test to the test suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants