Mercurial > kallithea
changeset 8124:a553bc3a3d0e
py3: open files as binary or not, depending on how we want to use them
The difference will matter when bytes and str are different.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Fri, 27 Dec 2019 01:46:11 +0100 |
parents | 6fa658082c8e |
children | 5ddd6b930dd0 |
files | kallithea/lib/pidlock.py kallithea/tests/vcs/test_archives.py setup.py |
diffstat | 3 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/pidlock.py Thu Jan 02 23:19:36 2020 +0100 +++ b/kallithea/lib/pidlock.py Fri Dec 27 01:46:11 2019 +0100 @@ -137,6 +137,6 @@ dir_, file_ = os.path.split(pidfile) if not os.path.isdir(dir_): os.makedirs(dir_) - with open(self.pidfile, 'wb') as f: + with open(self.pidfile, 'w') as f: f.write(lockname) self.held = True
--- a/kallithea/tests/vcs/test_archives.py Thu Jan 02 23:19:36 2020 +0100 +++ b/kallithea/tests/vcs/test_archives.py Fri Dec 27 01:46:11 2019 +0100 @@ -51,7 +51,7 @@ for x in xrange(5): node_path = '%d/file_%d.txt' % (x, x) - assert open(os.path.join(outdir, 'repo/' + node_path)).read() == self.tip.get_node(node_path).content + assert open(os.path.join(outdir, 'repo/' + node_path), 'rb').read() == self.tip.get_node(node_path).content def test_archive_tbz2(self): path = tempfile.mkstemp(dir=TESTS_TMP_PATH, prefix='test_archive_tbz2-')[1] @@ -64,7 +64,7 @@ for x in xrange(5): node_path = '%d/file_%d.txt' % (x, x) - assert open(os.path.join(outdir, 'repo/' + node_path)).read() == self.tip.get_node(node_path).content + assert open(os.path.join(outdir, 'repo/' + node_path), 'rb').read() == self.tip.get_node(node_path).content def test_archive_default_stream(self): tmppath = tempfile.mkstemp(dir=TESTS_TMP_PATH, prefix='test_archive_default_stream-')[1]
--- a/setup.py Thu Jan 02 23:19:36 2020 +0100 +++ b/setup.py Fri Dec 27 01:46:11 2019 +0100 @@ -25,7 +25,7 @@ return callback_handler(eval(matches.groups()[0])) -_meta = open(os.path.join(here, 'kallithea', '__init__.py'), 'rb') +_meta = open(os.path.join(here, 'kallithea', '__init__.py'), 'r') _metadata = _meta.read() _meta.close()