diff options
author | Andy McCurdy <andy@andymccurdy.com> | 2014-07-06 19:52:28 -0700 |
---|---|---|
committer | Andy McCurdy <andy@andymccurdy.com> | 2014-07-06 19:52:28 -0700 |
commit | 83013b5df1ea32213a77f81be08ffb40d56bace6 (patch) | |
tree | 4a8248cd2a33f61666a9c18b2472bd6b58239e0b /redis/connection.py | |
parent | 310cb1c58c059fc6d007a67edda8166fb4c962e6 (diff) | |
download | redis-py-83013b5df1ea32213a77f81be08ffb40d56bace6.tar.gz |
check for the server closing a connection that's compatible with Python 3
fixes #508
Diffstat (limited to 'redis/connection.py')
-rwxr-xr-x | redis/connection.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/redis/connection.py b/redis/connection.py index 4c14233..e39bd39 100755 --- a/redis/connection.py +++ b/redis/connection.py @@ -108,7 +108,7 @@ class SocketBuffer(object): while True: data = self._sock.recv(socket_read_size) # an empty string indicates the server shutdown the socket - if isinstance(data, str) and len(data) == 0: + if isinstance(data, bytes) and len(data) == 0: raise socket.error("Connection closed by remote server.") buf.write(data) data_length = len(data) @@ -314,7 +314,7 @@ class HiredisParser(BaseParser): try: buffer = self._sock.recv(socket_read_size) # an empty string indicates the server shutdown the socket - if isinstance(buffer, str) and len(buffer) == 0: + if isinstance(buffer, bytes) and len(buffer) == 0: raise socket.error("Connection closed by remote server.") except socket.timeout: raise TimeoutError("Timeout reading from socket") |