comparison mercurial/wireproto.py @ 30924: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
comparison
equal deleted inserted replaced
30923:78de43ab585f 30924:48dea083f66d
24 encoding, 24 encoding,
25 error, 25 error,
26 exchange, 26 exchange,
27 peer, 27 peer,
28 pushkey as pushkeymod, 28 pushkey as pushkeymod,
29 pycompat,
29 streamclone, 30 streamclone,
30 util, 31 util,
31 ) 32 )
32 33
33 urlerr = util.urlerr 34 urlerr = util.urlerr
959 960
960 exchange.check_heads(repo, their_heads, 'preparing changes') 961 exchange.check_heads(repo, their_heads, 'preparing changes')
961 962
962 # write bundle data to temporary file because it can be big 963 # write bundle data to temporary file because it can be big
963 fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-') 964 fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-')
964 fp = os.fdopen(fd, 'wb+') 965 fp = os.fdopen(fd, pycompat.sysstr('wb+'))
965 r = 0 966 r = 0
966 try: 967 try:
967 proto.getfile(fp) 968 proto.getfile(fp)
968 fp.seek(0) 969 fp.seek(0)
969 gen = exchange.readbundle(repo.ui, fp, None) 970 gen = exchange.readbundle(repo.ui, fp, None)