diff --git a/src/dumdum/protocol/reader.py b/src/dumdum/protocol/reader.py index 8ca8a6f..f565ec4 100644 --- a/src/dumdum/protocol/reader.py +++ b/src/dumdum/protocol/reader.py @@ -20,7 +20,9 @@ def read(self, n: int = -1) -> bytes: n = min(n, len(self.buffer)) start, self._index = self._index, self._index + n - return self.buffer[start : self._index] + + data = self.buffer[start : self._index] + return bytes(data) if isinstance(data, bytearray) else data def readexactly(self, n: int) -> bytes: if n < 0: