Commit 56391dc8 authored by Aaron1011's avatar Aaron1011
Browse files

Merge pull request #513 from 7kry/master

Modify ReadBuffer for Py3
parents 2c2cc03b 48d2744d
......@@ -146,7 +146,7 @@ class ReadBuffer(object):
def __init__(self, stream, chunk_size):
self._stream = stream
self._buffer = ""
self._buffer = u""
self._chunk_size = chunk_size
def read_len(self, length):
......@@ -154,7 +154,7 @@ class ReadBuffer(object):
if len(self._buffer) >= length:
return self._pop(length)
read_len = max(self._chunk_size, length - len(self._buffer))
self._buffer += self._stream.read(read_len)
self._buffer += self._stream.read(read_len).decode("ascii")
def read_line(self, sep='\n'):
start = 0
......@@ -164,7 +164,7 @@ class ReadBuffer(object):
return self._pop(loc + len(sep))
else:
start = len(self._buffer)
self._buffer += self._stream.read(self._chunk_size)
self._buffer += self._stream.read(self._chunk_size).decode("ascii")
def _pop(self, length):
r = self._buffer[:length]
......
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