[Merge] lp:~mvo/ubuntu-release-upgrader/lp1071388 into lp:ubuntu-release-upgrader
Michael Vogt
michael.vogt at ubuntu.com
Fri Nov 9 07:37:18 UTC 2012
On Wed, Nov 07, 2012 at 08:47:18PM -0000, Barry Warsaw wrote:
> A couple of quick thoughts: you might want to use "utf-8" instead of "utf8". It doesn't matter in practice, but better matches what getpreferredencoding() returns. Very minor nit.
Thanks, I fixed that.
> Also, in Python 3, we're generally calling subprocess.Popen(..., universal_newlines=True) now so that you can send unicode to the subprocess instead of bytes. That may avoid a call to .encode() below.
>
> http://docs.python.org/3/library/subprocess.html#frequently-used-arguments
Thanks, I will have to look in more details, but afaict this is also
because we get the data as bytes sometimes.
> decoding the results of sys.stdin.readline() also looks a bit suspect to me, since that should already return str instead of bytes. Are you sure that works? See also `python3 -h` and the PYTHONIOENCODING envar.
This code runs under py2 most of the time as the upgrade needs to be
support back to precise with the default install there. I.e.:
$ python -c 'import sys; print sys.getdefaultencoding()'
ascii
$ python3 -c 'import sys; print(sys.getdefaultencoding())'
utf-8
And it seems like py2 does not honor PYTHONIOENCODING :/
Cheers,
Michael
--
https://code.launchpad.net/~mvo/ubuntu-release-upgrader/lp1071388/+merge/132851
Your team Ubuntu Core Development Team is subscribed to branch lp:ubuntu-release-upgrader.
More information about the Ubuntu-reviews
mailing list