diff -r 78de43ab585f -r 48dea083f66d mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py Thu Feb 09 15:20:41 2017 -0500 +++ b/mercurial/bundlerepo.py Mon Feb 13 20:06:38 2017 +0530 @@ -272,7 +272,7 @@ suffix=".hg10un") self.tempfile = temp - with os.fdopen(fdtemp, 'wb') as fptemp: + with os.fdopen(fdtemp, pycompat.sysstr('wb')) as fptemp: fptemp.write(header) while True: chunk = read(2**18)