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

Fix bug in string output of empty array #139

Merged

Conversation

Thirdegree
Copy link
Contributor

>>> from tomlkit import item, dumps, loads
>>> t = item([])
>>> t.multiline(True)
[]
>>> print(dumps(t))
[
    ,
]
>>> loads(dumps(t))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/thirdegree/.virtualenvs/tmp-b9dbc870a56cb56/lib/python3.6/site-packages/tomlkit/api.py", line 34, in loads
    return parse(string)
  File "/home/thirdegree/.virtualenvs/tmp-b9dbc870a56cb56/lib/python3.6/site-packages/tomlkit/api.py", line 51, in parse
    return Parser(string).parse()
  File "/home/thirdegree/.virtualenvs/tmp-b9dbc870a56cb56/lib/python3.6/site-packages/tomlkit/parser.py", line 160, in parse
    key, value = self._parse_table()
  File "/home/thirdegree/.virtualenvs/tmp-b9dbc870a56cb56/lib/python3.6/site-packages/tomlkit/parser.py", line 1076, in _parse_table
    name_parts = tuple(self._split_table_name(name))
  File "/home/thirdegree/.virtualenvs/tmp-b9dbc870a56cb56/lib/python3.6/site-packages/tomlkit/parser.py", line 267, in _split_table_name
    raise self.parse_error()
tomlkit.exceptions.ParseError: TOML parse error at line 3 col 0
>>>

```python
>>> from tomlkit import item, dumps, loads
>>> t = item([])
>>> t.multiline(True)
[]
>>> print(dumps(t))
[
    ,
]
>>> loads(dumps(t))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/thirdegree/.virtualenvs/tmp-b9dbc870a56cb56/lib/python3.6/site-packages/tomlkit/api.py", line 34, in loads
    return parse(string)
  File "/home/thirdegree/.virtualenvs/tmp-b9dbc870a56cb56/lib/python3.6/site-packages/tomlkit/api.py", line 51, in parse
    return Parser(string).parse()
  File "/home/thirdegree/.virtualenvs/tmp-b9dbc870a56cb56/lib/python3.6/site-packages/tomlkit/parser.py", line 160, in parse
    key, value = self._parse_table()
  File "/home/thirdegree/.virtualenvs/tmp-b9dbc870a56cb56/lib/python3.6/site-packages/tomlkit/parser.py", line 1076, in _parse_table
    name_parts = tuple(self._split_table_name(name))
  File "/home/thirdegree/.virtualenvs/tmp-b9dbc870a56cb56/lib/python3.6/site-packages/tomlkit/parser.py", line 267, in _split_table_name
    raise self.parse_error()
tomlkit.exceptions.ParseError: TOML parse error at line 3 col 0
>>>
```
@Thirdegree Thirdegree force-pushed the fix-multiline-output-empty-array branch from f50a19d to aa92087 Compare July 25, 2021 16:23
tomlkit/items.py Outdated Show resolved Hide resolved
@frostming frostming merged commit f4261cd into python-poetry:master Dec 17, 2021
capuanob pushed a commit to capuanob/tomlkit that referenced this pull request Mar 1, 2023
…tput-empty-array

Fix bug in string output of empty array
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

Successfully merging this pull request may close these issues.

2 participants