uiri / toml

Python lib for TOML
MIT License
1.08k stars 189 forks source link

Unable to parse array of mixed types (string + array) - IndexError: list index out of range: #444

Open nekromoff opened 1 month ago

nekromoff commented 1 month ago

See: https://github.com/toml-lang/toml/issues/1033

python report.py
Traceback (most recent call last):
File "report.py", line 10, in <module>
config=toml.load("config.toml")
File "/home/xxx/.local/lib/python3.10/site-packages/toml/decoder.py", line 134, in load
return loads(ffile.read(), _dict, decoder)
File "/home/xxx/.local/lib/python3.10/site-packages/toml/decoder.py", line 511, in loads
ret = decoder.load_line(line, currentlevel, multikey,
File "/home/xxx/.local/lib/python3.10/site-packages/toml/decoder.py", line 778, in load_line
value, vtype = self.load_value(pair[1], strictly_valid)
File "/home/xxx/.local/lib/python3.10/site-packages/toml/decoder.py", line 880, in load_value
return (self.load_array(v), "array")
File "/home/xxx/.local/lib/python3.10/site-packages/toml/decoder.py", line 1002, in load_array
a[b] = a[b] + ',' + a[b + 1]
IndexError: list index out of range

TOML line that crashes the parser:

ping = ["/usr/bin/ping -c4 8.8.8.8", ["packets", "rtt"] ]
nekromoff commented 1 month ago

Probably duplicate of https://github.com/uiri/toml/issues/270

nekromoff commented 1 month ago

I found https://github.com/hukkin/tomli that does not have this issue, if somebody stumbles on this error.