Commit 93014f2b authored by W. Trevor King's avatar W. Trevor King
Browse files

Convert buffer(...) -> bytes(...) for Python 3 compatibility.

parent d2c87ab4
......@@ -82,10 +82,10 @@ class StaticStringField (_DynamicField):
if end > start:
strings.append(d[start:end])
if self._null_terminated:
strings[-1] = strings[-1].split('\x00', 1)[0]
strings[-1] = strings[-1].split(b'\x00', 1)[0]
start = end
elif self._null_terminated:
d = d.split('\x00', 1)[0]
d = d.split(b'\x00', 1)[0]
return d
......
......@@ -67,7 +67,7 @@ def load(filename, strict=True, ignore_unknown=True):
while True:
PackedFileRecordHeader.byte_order = initial_byte_order
PackedFileRecordHeader.setup()
b = buffer(f.read(PackedFileRecordHeader.size))
b = bytes(f.read(PackedFileRecordHeader.size))
if not b:
break
if len(b) < PackedFileRecordHeader.size:
......@@ -88,7 +88,7 @@ def load(filename, strict=True, ignore_unknown=True):
header = PackedFileRecordHeader.unpack_from(b)
_LOG.debug(
'reordered version: {}'.format(header['version']))
data = buffer(f.read(header['numDataBytes']))
data = bytes(f.read(header['numDataBytes']))
if len(data) < header['numDataBytes']:
raise ValueError(
('not enough data for the next record ({} < {})'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment