Mercurial > public > mercurial-scm > hg
comparison mercurial/changegroup.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 | 5859800edfc5 |
children | 83534c4ec58b |
comparison
equal
deleted
inserted
replaced
38163:b39958d6b81b | 38164:aac4be30e250 |
---|---|
7 | 7 |
8 from __future__ import absolute_import | 8 from __future__ import absolute_import |
9 | 9 |
10 import os | 10 import os |
11 import struct | 11 import struct |
12 import tempfile | |
13 import weakref | 12 import weakref |
14 | 13 |
15 from .i18n import _ | 14 from .i18n import _ |
16 from .node import ( | 15 from .node import ( |
17 hex, | 16 hex, |
78 else: | 77 else: |
79 # Increase default buffer size because default is usually | 78 # Increase default buffer size because default is usually |
80 # small (4k is common on Linux). | 79 # small (4k is common on Linux). |
81 fh = open(filename, "wb", 131072) | 80 fh = open(filename, "wb", 131072) |
82 else: | 81 else: |
83 fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg") | 82 fd, filename = pycompat.mkstemp(prefix="hg-bundle-", suffix=".hg") |
84 fh = os.fdopen(fd, r"wb") | 83 fh = os.fdopen(fd, r"wb") |
85 cleanup = filename | 84 cleanup = filename |
86 for c in chunks: | 85 for c in chunks: |
87 fh.write(c) | 86 fh.write(c) |
88 cleanup = None | 87 cleanup = None |