Error when encoding strings which contain control characters #246
Labels
component: encoder
Related to serialising in `toml.dump`
syntax: strings
Related to string literals
type: bug
A confirmed bug or unintended behavior
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.7/site-packages/toml/encoder.py", line 47, in dumps
addtoretval, sections = encoder.dump_sections(o, "")
File "/usr/local/lib/python3.7/site-packages/toml/encoder.py", line 209, in dump_sections
unicode(self.dump_value(o[section])) + '\n')
File "/usr/local/lib/python3.7/site-packages/toml/encoder.py", line 160, in dump_value
return dump_fn(v) if dump_fn is not None else self.dump_funcsstr
File "/usr/local/lib/python3.7/site-packages/toml/encoder.py", line 94, in _dump_str
v = [v[0] + joiner + v[1]] + v[2:]
IndexError: list index out of range
This value can be represented in TOML, and in fact the library is able to decode it correctly:
But this input can't be round-tripped:
(same stack trace)
The text was updated successfully, but these errors were encountered: