[pacman-dev] [PATCH 8/8] Allow tests to be run with either version 2 or 3 of Python.

Jeremy Heiner scalaprotractor at gmail.com
Thu Oct 10 07:02:42 EDT 2013

On Thu, Oct 10, 2013 at 12:50 AM, Martin Panter <vadmium+patch at gmail.com> wrote:
> To me, having learnt Python 3 before Python 2, I found the name
> new_StringIO() misleading, since you are actually returning a BytesIO
> object. Anyway, the “io” module was added in Python 2.6, so maybe you
> can get rid of the whole workaround.

Yeah, in retrospect that wasn't the best choice of name. It was
accurate for the commit that introduced the function, but then the
later commit changed to BytesIO and it didn't occur to me to clean up
the name.

> Python 2 can also do str.encode("utf8"), why only do it for Python 3?

Only to avoid changing the behavior under Python 2. But I agree that
it would be wiser to specify an encoding in all cases. Thanks, I'll
incorporate that into a revised patch set (if there is a need for

More information about the pacman-dev mailing list