toml
toml copied to clipboard
bug: comma in list's value is not parsed properly
toml==0.10.1
>>> import toml
>>> toml_string = """
... a=[',', '']
... """
>>> toml.loads(toml_string)
{'a': ['', '', '']}
So the result's list's length is 3 instead of 2.
This is the offending line: https://github.com/uiri/toml/blob/master/toml/decoder.py#L946 Working on a pull request now
Awesome! Thanks
On Oct 15, 2020, at 5:23 PM, markman123 [email protected] wrote:
This is the offending line: https://github.com/uiri/toml/blob/master/toml/decoder.py#L946 Working on a pull request now
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
In the meantime, it's possible to work around this with unicode escapes:
my_list = [
"Hello\u002C World!",
"Lovely day\u002C isn't it?"
]
It's not pretty, but it works.
I was hit by this as well.
Hey @uiri It is the anniversary of this ticket. Any updates? Best
This hit me too - thanks for the workaround @ZeroKnight
By the way, I have stopped using this library. pip
comes with a toml parser! And it doesn't have this annoying bug.
from pip._vendor import tomli
tomli.loads(contents)