[issue9561] distutils: set encoding to utf-8 for input and output files

STINNER Victor report at bugs.python.org
Fri Jul 1 00:04:57 CEST 2011


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

> Okay.  I guess you’ll use codecs.open in 2.7

Oh, Python 2.7... DistributionMetadata of distutils encodes most values to byte strings (get_xxx() methods calls self._encode_field). It would be possible to use codecs.open(), but an Unicode file expects Unicode strings. The problem is that the user may provide arbitrary byte strings, I mean strings not encoded to PKG_INFO_ENCODING. Even if such strings are *wrong* (not correctly encoded), is it a good idea to be more strict in a minor version (2.7.x)?

I don't want to be responsible of such tricky change, I prefer to leave distutils unchanged in Python 2.7 (at least for PKG-INFO).

> please make sure there is no bootstrapping issue
> for the build of CPython itself.

I checked, there is not bootstrap issue.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9561>
_______________________________________


More information about the Python-bugs-list mailing list