bobfang1992 / pytomlpp

A python wrapper for tomlplusplus
https://bobfang1992.github.io/pytomlpp/pytomlpp.html
MIT License
86 stars 11 forks source link

Carriage return should fail parsing #68

Closed pwwang closed 2 years ago

pwwang commented 2 years ago

References:

marzer commented 2 years ago

Hmm, this was fixed in toml++ 3.0.0, on which this library is based. Are you using a current version of pytomlpp?

Edit: Actually, looking at the list of "invalid" parses that pytomlpp fails in your third link, it seems to be that there's some newline normalisation going on before parsing. Both of those things are definitely fixed in toml++.

pwwang commented 2 years ago

You are right. The normalization happened when the file is read by Path.read_text() or open(path, "r").

Path.read_bytes() or open(path, "rb") should be the right way.

marzer commented 2 years ago

@pwwang nice project, btw. Interesting to see that using tomli's benchmark data shows pytomlpp as being faster than rtoml, but then using pytomlpp's own data it's the other way around. Looks like tomli's benchmark data tests a few more paths of the parser.

pwwang commented 2 years ago

Yep, it's funny. I noticed that, too. And it is actually sort of reproducible, even though the difference is negligible.