toml
toml copied to clipboard
Multiple-line strings don't get escaped when a TOML format included
>>> import toml
>>> import tomlkit
>>> s = """
... string = ['''
... [item]
... a = 1
... ''', '''
... [item]
... a = 2
... ''']
... """
>>> toml.loads(s)
Traceback (most recent call last):
File "<input>", line 1, in <module>
toml.loads(s)
File "/.../lib/python3.9/site-packages/toml/decoder.py", line 514, in loads
raise TomlDecodeError(str(err), original, pos)
toml.decoder.TomlDecodeError: Duplicate keys! (line 7 column 1 char 44)
>>> tomlkit.parse(s)
{'string': ['[item]\na = 1\n', '[item]\na = 2\n']}
another bug:
In [1]: import toml
In [2]: s = """
...: about = '''
...: hi
...:
...: - Hello world's hello
...:
...: ## hello hello hello hello hello hello
...: '''
...: """
...:
In [3]: print(toml.loads(s)['about'])
hi
- Hello world's hello
This library should have a warning that it shouldn't be used.