diff --git a/aiohttp/streams.py b/aiohttp/streams.py index b97846171b1..029d577b88c 100644 --- a/aiohttp/streams.py +++ b/aiohttp/streams.py @@ -517,8 +517,9 @@ def _read_nowait_chunk(self, n: int) -> bytes: else: data = self._buffer.popleft() - self._size -= len(data) - self._cursor += len(data) + data_len = len(data) + self._size -= data_len + self._cursor += data_len chunk_splits = self._http_chunk_splits # Prevent memory leak: drop useless chunk splits