# HG changeset patch # User Mads Kiilerich # Date 2019-12-27 00:46:11 # Node ID a553bc3a3d0eac3e44b9555332552c9d945c70e6 # Parent 6fa658082c8ebc4022ee02024025db640a561e5f 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. diff --git a/kallithea/lib/pidlock.py b/kallithea/lib/pidlock.py --- a/kallithea/lib/pidlock.py +++ b/kallithea/lib/pidlock.py @@ -137,6 +137,6 @@ class DaemonLock(object): 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 diff --git a/kallithea/tests/vcs/test_archives.py b/kallithea/tests/vcs/test_archives.py --- a/kallithea/tests/vcs/test_archives.py +++ b/kallithea/tests/vcs/test_archives.py @@ -51,7 +51,7 @@ class ArchivesTestCaseMixin(_BackendTest 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 @@ class ArchivesTestCaseMixin(_BackendTest 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] diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ def _get_meta_var(name, data, callback_h 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()