~chiefnoah/pybare

63e1977edaf4a6aa04cca2c3ca9370e2b6b47e58 — Shiftless 5 months ago 3417d9f
Fix unpacking of `Data` and `DataFixed`
1 files changed, 2 insertions(+), 2 deletions(-)

M bare/types.py
M bare/types.py => bare/types.py +2 -2
@@ 311,7 311,7 @@ class Data(Field):

    def _unpack(self, fp: typing.BinaryIO) -> "Data":
        length = _read_varint(fp, signed=False)
        val = struct.unpack("<{length}s", fp)[0]
        val = fp.read(length)
        return self.__class__(value=val)




@@ 357,7 357,7 @@ class DataFixed(Field):
    def _unpack(self, fp: typing.BinaryIO, length=None) -> "DataFixed":
        if length is None:
            length = self._length
        val = struct.unpack(f"<{length}s", fp)[0]
        val = fp.read(length)
        return self.__class__(value=val)