From: Aaron Hill Date: Sat, 5 Nov 2016 23:14:01 +0000 (-0400) Subject: Don't return None from ReadBuffer.read_line and ReadBuffer.read_len X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c1eddf1a5788ec4947d3a363dfe165ea599c31fc;p=tweepy.git Don't return None from ReadBuffer.read_line and ReadBuffer.read_len Closes #698 --- diff --git a/tweepy/streaming.py b/tweepy/streaming.py index c67047c..3d3fb47 100644 --- a/tweepy/streaming.py +++ b/tweepy/streaming.py @@ -162,6 +162,7 @@ class ReadBuffer(object): return self._pop(length) read_len = max(self._chunk_size, length - len(self._buffer)) self._buffer += self._stream.read(read_len) + return six.b('') def read_line(self, sep=six.b('\n')): """Read the data stream until a given separator is found (default \n) @@ -178,6 +179,7 @@ class ReadBuffer(object): else: start = len(self._buffer) self._buffer += self._stream.read(self._chunk_size) + return six.b('') def _pop(self, length): r = self._buffer[:length] @@ -323,7 +325,7 @@ class Stream(object): raise TweepError('Expecting length, unexpected value found') next_status_obj = buf.read_len(length) - if self.running: + if self.running and next_status_obj: self._data(next_status_obj) # # Note: keep-alive newlines might be inserted before each length value.