Avoid slice when the reader wants the full buffer

This commit is contained in:
J. Nick Koston 2024-09-03 17:07:36 -10:00
parent 9e46d00d26
commit c31bdde31c
No known key found for this signature in database

View File

@ -118,6 +118,7 @@ class APIFrameHelper:
if TYPE_CHECKING: if TYPE_CHECKING:
assert self._buffer is not None, "Buffer should be set" assert self._buffer is not None, "Buffer should be set"
if original_pos == 0 and self._buffer_len == new_pos: if original_pos == 0 and self._buffer_len == new_pos:
assert self._buffer == self._buffer[original_pos:new_pos]
return self._buffer return self._buffer
return self._buffer[original_pos:new_pos] return self._buffer[original_pos:new_pos]