comparison mercurial/httppeer.py @ 38164:aac4be30e250

py3: wrap tempfile.mkstemp() to use bytes path This patch just flips the default to use a bytes path on Python 3. ca1cf9b3cce7 is backed out as the bundlepath should be bytes now.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 26 May 2018 12:14:04 +0900
parents 6169d95dce3b
children ead71b15efd5
comparison
equal deleted inserted replaced
38163:b39958d6b81b 38164:aac4be30e250
11 import errno 11 import errno
12 import io 12 import io
13 import os 13 import os
14 import socket 14 import socket
15 import struct 15 import struct
16 import tempfile
17 import weakref 16 import weakref
18 17
19 from .i18n import _ 18 from .i18n import _
20 from .thirdparty import ( 19 from .thirdparty import (
21 cbor, 20 cbor,
517 fh = None 516 fh = None
518 fp_ = None 517 fp_ = None
519 filename = None 518 filename = None
520 try: 519 try:
521 # dump bundle to disk 520 # dump bundle to disk
522 fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg") 521 fd, filename = pycompat.mkstemp(prefix="hg-bundle-", suffix=".hg")
523 fh = os.fdopen(fd, r"wb") 522 fh = os.fdopen(fd, r"wb")
524 d = fp.read(4096) 523 d = fp.read(4096)
525 while d: 524 while d:
526 fh.write(d) 525 fh.write(d)
527 d = fp.read(4096) 526 d = fp.read(4096)