From eef08000e437ad826694fc498c711524893d6125 Mon Sep 17 00:00:00 2001 From: jlacoline Date: Wed, 19 Jul 2017 17:15:54 +0200 Subject: [PATCH] stream.readchunk() bugfix: do not raise IndexError when buffer is empty --- aiohttp/streams.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aiohttp/streams.py b/aiohttp/streams.py index 9a0e01136a9..8ad03e353b2 100644 --- a/aiohttp/streams.py +++ b/aiohttp/streams.py @@ -323,7 +323,9 @@ def readchunk(self): if self._exception is not None: raise self._exception - if not self._buffer and not self._eof: + if not self._buffer: + if self._eof: + return b"" yield from self._wait('readchunk') return self._read_nowait_chunk(-1)