Skip to content

Commit 8ae673e

Browse files
committed
Avoid bytes formatting on Python 3.4
1 parent 48d2e5f commit 8ae673e

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

tests/cdblib_test.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,14 @@ def reader_to_cdbmake_md5(self, filename):
4040
data = infile.read()
4141

4242
for key, value in self.reader_cls(data).iteritems():
43-
md5.update(b'+%d,%d:%s->%s\n' % (len(key), len(value), key, value))
43+
# Hack to work around lack of bytes.format() in Python 3.4
44+
data = '+{},{}:{}->{}\n'.format(
45+
len(key),
46+
len(value),
47+
key.decode('utf-8'),
48+
value.decode('utf-8')
49+
)
50+
md5.update(data.encode('utf-8'))
4451

4552
md5.update(b'\n')
4653

0 commit comments

Comments
 (0)