hercules-team / python-augeas

Python bindings for Augeas
GNU Lesser General Public License v2.1
44 stars 31 forks source link

Python bindings unnecessarily convert to/from utf8 #34

Open lutter opened 6 years ago

lutter commented 6 years ago

The rewritten Python bindings do a bunch of conversion to/from utf8, even though the underlying augeas library does not care whether strings it works on are valid utf8 or not. It seems that that just unnecessarily risks failures when strings are not valid utf8.

@thedrow could you have a look and see if the utf8 stuff is really needed ?

thedrow commented 6 years ago

This is for Python 3 compatibility. The old Python library did not return byte strings as far as I recall.

lutter commented 6 years ago

The problem here is that even for Python 2, the mandatory utf8 conversion makes things that used to work break: if a config file contains invalid utf8, augeas is perfectly happy with it, but once the Python bindings try to convert, things blow up.

At least for Python2, there should be no mandatory conversion so as to avoid that; and even for Python3, it would be good to find a way to avoid blowing up just because a file contains invalid utf8 - there's plenty of config files that are valid and processable even if they are not valid utf8.