Unverified Commit c1eddf1a authored by Aaron Hill's avatar Aaron Hill
Browse files

Don't return None from ReadBuffer.read_line and ReadBuffer.read_len

Closes #698
parent 22bfa552
...@@ -162,6 +162,7 @@ class ReadBuffer(object): ...@@ -162,6 +162,7 @@ class ReadBuffer(object):
return self._pop(length) return self._pop(length)
read_len = max(self._chunk_size, length - len(self._buffer)) read_len = max(self._chunk_size, length - len(self._buffer))
self._buffer += self._stream.read(read_len) self._buffer += self._stream.read(read_len)
return six.b('')
def read_line(self, sep=six.b('\n')): def read_line(self, sep=six.b('\n')):
"""Read the data stream until a given separator is found (default \n) """Read the data stream until a given separator is found (default \n)
...@@ -178,6 +179,7 @@ class ReadBuffer(object): ...@@ -178,6 +179,7 @@ class ReadBuffer(object):
else: else:
start = len(self._buffer) start = len(self._buffer)
self._buffer += self._stream.read(self._chunk_size) self._buffer += self._stream.read(self._chunk_size)
return six.b('')
def _pop(self, length): def _pop(self, length):
r = self._buffer[:length] r = self._buffer[:length]
...@@ -323,7 +325,7 @@ class Stream(object): ...@@ -323,7 +325,7 @@ class Stream(object):
raise TweepError('Expecting length, unexpected value found') raise TweepError('Expecting length, unexpected value found')
next_status_obj = buf.read_len(length) next_status_obj = buf.read_len(length)
if self.running: if self.running and next_status_obj:
self._data(next_status_obj) self._data(next_status_obj)
# # Note: keep-alive newlines might be inserted before each length value. # # Note: keep-alive newlines might be inserted before each length value.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment