From c1eddf1a5788ec4947d3a363dfe165ea599c31fc Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Sat, 5 Nov 2016 19:14:01 -0400 Subject: [PATCH] Don't return None from ReadBuffer.read_line and ReadBuffer.read_len Closes #698 --- tweepy/streaming.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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. -- 2.25.1