summaryrefslogtreecommitdiff
path: root/msgpack/_msgpack.pyx
diff options
context:
space:
mode:
authorinada-n <songofacandy@gmail.com>2009-12-16 22:05:31 +0900
committerinada-n <songofacandy@gmail.com>2009-12-16 22:05:31 +0900
commit35a4d612c9f45c238f78f37013a4be4c9d74c13b (patch)
tree3b8a1e4a5a9e2c5682c65a84cd64a7adc9ebe419 /msgpack/_msgpack.pyx
parente72aa01fe5192960618544ec0394112904b24c7d (diff)
downloadmsgpack-python-35a4d612c9f45c238f78f37013a4be4c9d74c13b.tar.gz
Fix stream unpacker broken.
Diffstat (limited to 'msgpack/_msgpack.pyx')
-rw-r--r--msgpack/_msgpack.pyx12
1 files changed, 11 insertions, 1 deletions
diff --git a/msgpack/_msgpack.pyx b/msgpack/_msgpack.pyx
index cb95146..9ff0c57 100644
--- a/msgpack/_msgpack.pyx
+++ b/msgpack/_msgpack.pyx
@@ -233,7 +233,9 @@ cdef class Unpacker(object):
if self.buf:
free(self.buf);
- def __init__(self, file_like=None, int read_size=1024*1024):
+ def __init__(self, file_like=None, int read_size=0):
+ if read_size == 0:
+ read_size = 1024*1024
self.file_like = file_like
self.read_size = read_size
self.waiting_bytes = []
@@ -309,6 +311,7 @@ cdef class Unpacker(object):
self.fill_buffer()
ret = template_execute(&self.ctx, self.buf, self.buf_tail, &self.buf_head)
if ret == 1:
+ template_init(&self.ctx)
return template_data(&self.ctx)
elif ret == 0:
if self.file_like is not None:
@@ -319,3 +322,10 @@ cdef class Unpacker(object):
def __iter__(self):
return UnpackIterator(self)
+
+ # for debug.
+ #def _buf(self):
+ # return PyString_FromStringAndSize(self.buf, self.buf_tail)
+
+ #def _off(self):
+ # return self.buf_head