summaryrefslogtreecommitdiff
path: root/python/msgpack
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
commitdd18402737bdd12fbf53fe0543e29509f9609f3f (patch)
tree44e5e1751f5a5f7171ac40757d33a3d70e31bd6f /python/msgpack
parent686e8ca0f004004f4b8e10438fe91a48a95e6ff9 (diff)
downloadmsgpack-python-dd18402737bdd12fbf53fe0543e29509f9609f3f.tar.gz
Fix stream unpacker broken.
Diffstat (limited to 'python/msgpack')
-rw-r--r--python/msgpack/_msgpack.pyx12
1 files changed, 11 insertions, 1 deletions
diff --git a/python/msgpack/_msgpack.pyx b/python/msgpack/_msgpack.pyx
index cb95146..9ff0c57 100644
--- a/python/msgpack/_msgpack.pyx
+++ b/python/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