Trying to stop the stream bugs
@@ -129,10 +129,13 @@ class InMemStream(Stream):
future.set_exception(self.exception)
return future
- chunk = b""
+ chunk = ""
while len(self._stream) and len(chunk) < common.MAX_PAYLOAD_SIZE:
- chunk += self._stream.popleft()
+ new_chunk = self._stream.popleft()
+ if six.PY3 and isinstance(new_chunk, bytes):
+ new_chunk.decode('utf8')
+ chunk += new_chunk
future.set_result(chunk)
return future
