--- a/mercurial/ui.py Mon Feb 13 20:06:38 2017 +0530
+++ b/mercurial/ui.py Mon Feb 13 22:15:28 2017 +0530
@@ -1038,7 +1038,7 @@
suffix=extra['suffix'], text=True,
dir=rdir)
try:
- f = os.fdopen(fd, "w")
+ f = os.fdopen(fd, pycompat.sysstr("w"))
f.write(text)
f.close()