Mercurial > hg-stable
changeset 36791:1fbbb8e83392
py3: read/write plain lock file in binary mode
A lock file shouldn't contain '\n', so this isn't a BC.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 04 Mar 2018 18:21:16 -0500 |
parents | 86ba6e3eba4e |
children | e3732c3ab92d |
files | contrib/python3-whitelist mercurial/util.py |
diffstat | 2 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/python3-whitelist Mon Mar 05 12:31:08 2018 -0500 +++ b/contrib/python3-whitelist Sun Mar 04 18:21:16 2018 -0500 @@ -373,6 +373,7 @@ test-subrepo.t test-symlinks.t test-tag.t +test-tags.t test-treemanifest.t test-unamend.t test-uncommit.t
--- a/mercurial/util.py Mon Mar 05 12:31:08 2018 -0500 +++ b/mercurial/util.py Sun Mar 04 18:21:16 2018 -0500 @@ -1685,7 +1685,8 @@ except AttributeError: # no symlink in os pass - ld = os.open(pathname, os.O_CREAT | os.O_WRONLY | os.O_EXCL) + flags = os.O_CREAT | os.O_WRONLY | os.O_EXCL | getattr(os, 'O_BINARY', 0) + ld = os.open(pathname, flags) os.write(ld, info) os.close(ld) @@ -1697,7 +1698,7 @@ raise except AttributeError: # no symlink in os pass - fp = posixfile(pathname) + fp = posixfile(pathname, 'rb') r = fp.read() fp.close() return r