diff mercurial/wireproto.py @ 30944:48dea083f66d

py3: convert the mode argument of os.fdopen to unicodes (1 of 2) os.fdopen() does not accepts bytes as its second argument which represent the mode in which the file is to be opened. This patch makes sure unicodes are passed in py3 by using pycompat.sysstr().
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 13 Feb 2017 20:06:38 +0530
parents f3807a135e43
children 2cf1e5207fdf
line wrap: on
line diff
--- a/mercurial/wireproto.py	Thu Feb 09 15:20:41 2017 -0500
+++ b/mercurial/wireproto.py	Mon Feb 13 20:06:38 2017 +0530
@@ -26,6 +26,7 @@
     exchange,
     peer,
     pushkey as pushkeymod,
+    pycompat,
     streamclone,
     util,
 )
@@ -961,7 +962,7 @@
 
         # write bundle data to temporary file because it can be big
         fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-')
-        fp = os.fdopen(fd, 'wb+')
+        fp = os.fdopen(fd, pycompat.sysstr('wb+'))
         r = 0
         try:
             proto.getfile(fp)