ITADN

[TomlSerializationError] values must be emitted before tables

#80Closedpwwang 创建于 2024-06-25
P
pwwangcommented
The item from pytomlpp benchmark that when loaded, can't be dumped again with rtoml: https://github.com/bobfang1992/pytomlpp/blob/47d705b909deee0fa7a3c65624bfa83ea87f578d/benchmark/data.toml#L431-L437 ```toml [terrible.capable-tent.wilderness-aromatic.birds.naughty-blind] bake-scatter-cross = [ 234, { attempt-selfish-ghost = 08:43:45, draconian-ski-scintillating = 1911-03-24T12:01:06-01:20, dreary = 266 }, 'innocent broken equable adhesive spiritual title respect' ] # hard-to-find protective ticket-enthusiastic-delightful = [ 428, 12:49:26, [ 07:10:40, 'neck unadvised finicky stale rest', true ] ] ``` This is the error: ```[TomlSerializationError] values must be emitted before tables``` A simple way to reproduce: ```python import rtoml toml = """ [a] b = [234, { c = 1, d = 2, e = 3}, 'abc'] f = [345, "def", [4, "ghi", 456]] """ loaded = rtoml.loads(toml) rtoml.dumps(loaded) ``` Error: ``` Traceback (most recent call last): File "<stdin>", line 1, in <module> File "path/to/lib/python3.12/site-packages/rtoml/__init__.py", line 62, in dumps return serialize(obj, none_value=none_value) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ _rtoml.TomlSerializationError: values must be emitted before tables ``` _Originally posted by @pwwang in https://github.com/pwwang/toml-bench/issues/7#issuecomment-2189638082_
关闭于 2024-06-25 2 条评论