[pacman-dev] [PATCH v2 5/8] Avoid problematic use of Python's StringIO.

Martin Panter vadmium+patch at gmail.com
Sun Oct 20 20:56:47 EDT 2013


On 20 October 2013 12:26, Jeremy Heiner <scalaprotractor at gmail.com> wrote:
> On Mon, Oct 14, 2013 at 6:38 PM, Jeremy Heiner
> <scalaprotractor at gmail.com> wrote:
>> Probably not tonight, but soon.
>
> Status update: I've only been able to find an hour since then to work
> on this; unfortunately did not just work and I haven't had time yet to
> figure out what I'm doing wrong.

Hi Jeremy,

I just discovered another (but related) issue under Python 3 that you
may not be aware of. There are places in the code, at least
writedata() in util.py, that write to a text file, but do not specify
an encoding. If you run the tests with LC_ALL=C, some of them fail in
Python 3 (but succeed in Python 2) because they are writing non-ASCII
characters.

The simplest solution might be to use codecs.open(encoding='utf8'),
which is available in Python 2 and 3, and should continue to write the
existing ASCII-only byte strings in Python 2.


More information about the pacman-dev mailing list