Bug 1417387 - Don't mix unicode and bytes in clobber code; r=nalexander

b6adf66f34c6 (bug 1416052) changed the value for "fh" when this code
is called. It can now be an io.BytesIO. This type enforces that
arguments are bytes and doesn't perform automatic type coercion like
most other parts of Python 2.

self.topobjdir is a unicode. And unicode_literals isn't in effect
in this file. So convert self.topobjdir to bytes to make BytesIO
happy.

MozReview-Commit-ID: LrWTKFp3ZKT

--HG--
extra : rebase_source : dc8b9cabe199c78073c96b1c16f9960f92e399e4
This commit is contained in:
Gregory Szorc 2017-11-15 10:17:26 -08:00
parent 2f874411a0
commit bfcec985a7

View File

@ -189,7 +189,8 @@ class Clobberer(object):
return True, False, self._message(
'Cannot clobber while the shell is inside the object directory.')
print('Automatically clobbering %s' % self.topobjdir, file=fh)
objdir = self.topobjdir.encode('utf-8', 'replace')
print('Automatically clobbering %s' % objdir, file=fh)
try:
self.remove_objdir(False)
self.ensure_objdir_state()