Skip to content

"Values must be emitted before tables" if array of values follows array of tables #61

Description

@VOsakosa

When a list that is dumped inline is defined in a dict before a list of tables, dumping fails. This is duplicate of #45, which was already closed.

Minimal working example

>>>import rtoml
>>>rtoml.dumps({'bookmarks': [{'ch': 12.0}],'auto_download': ['ja']})
File .venv/lib/python3.11/site-packages/rtoml/__init__.py:49, in dumps(obj, pretty)
     46 else:
     47     serialize = _rtoml.serialize
---> 49 return serialize(obj)

TomlSerializationError: values must be emitted before tables

This does not occur if the order of the keys is switched:

>>>import rtoml
>>>print(rtoml.dumps({'auto_download': ['ja'],'bookmarks': [{'ch': 12.0}]}))
auto_download = ["ja"]

[[bookmarks]]
ch = 12.0

Taking care to define the items in the right order is for now a doable workaround.

rtoml Version: 0.9.0
Python Version: 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions