~chiefnoah/pybare

d0714d312aabd7e85c55cc8a29e6ebd903d2bd11 — Noah Pederson 8 months ago 743a76f
Fix native types not packing in arrays
1 files changed, 4 insertions(+), 1 deletions(-)

M bare/encoder.py
M bare/encoder.py => bare/encoder.py +4 -1
@@ 344,7 344,10 @@ class Array(Field):
                default = self._type.__class__()
            value.extend([default] * (self._length - len(value))) # pad with default values
        for item in value:
            self._type._pack(fp, item.value)
            if isinstance(item, Field):
                self._type._pack(fp, item.value)
            else:
                self._type._pack(fp, item)

    def _unpack(self, fp: typing.BinaryIO) -> 'Array':
        if self._length == 0: