pycompat: extract function that converts attribute or encoding name to str
This will be used to convert encoding.encoding to a str acceptable by
Python 3 functions.
The source encoding is changed to "latin-1" because encoding.encoding can
have arbitrary bytes. Since valid names should consist of ASCII characters,
we don't care about the mapping of non-ASCII characters so long as invalid
names are distinct from valid names.
Added signature for changeset
149433e68974
pycompat: provide 'ispy3' constant
We compare version_info at several places, which seems enough to define
a constant.