summaryrefslogtreecommitdiff
path: root/msgpack/_msgpack.pyx
diff options
context:
space:
mode:
authorINADA Naoki <songofacandy@gmail.com>2011-01-28 18:59:05 +0900
committerINADA Naoki <songofacandy@gmail.com>2011-01-28 18:59:05 +0900
commit77a97b9c16bfabe1f8816c348d65e1d8277780d6 (patch)
tree7fd124f6fb21df1912de7c23c7b98051d9c25976 /msgpack/_msgpack.pyx
parentb453385d92e549204e7e1639f286589a38143061 (diff)
downloadmsgpack-python-77a97b9c16bfabe1f8816c348d65e1d8277780d6.tar.gz
Add use_list option to unpack and unpackb
Diffstat (limited to 'msgpack/_msgpack.pyx')
-rw-r--r--msgpack/_msgpack.pyx8
1 files changed, 4 insertions, 4 deletions
diff --git a/msgpack/_msgpack.pyx b/msgpack/_msgpack.pyx
index 9f817dd..9564171 100644
--- a/msgpack/_msgpack.pyx
+++ b/msgpack/_msgpack.pyx
@@ -167,7 +167,7 @@ cdef extern from "unpack.h":
object template_data(template_context* ctx)
-def unpackb(object packed, object object_hook=None, object list_hook=None):
+def unpackb(object packed, object object_hook=None, object list_hook=None, bint use_list=0):
"""Unpack packed_bytes to object. Returns an unpacked object."""
cdef template_context ctx
cdef size_t off = 0
@@ -178,7 +178,7 @@ def unpackb(object packed, object object_hook=None, object list_hook=None):
PyObject_AsReadBuffer(packed, <const_void_ptr*>&buf, &buf_len)
template_init(&ctx)
- ctx.user.use_list = 0
+ ctx.user.use_list = use_list
ctx.user.object_hook = ctx.user.list_hook = NULL
if object_hook is not None:
if not PyCallable_Check(object_hook):
@@ -196,9 +196,9 @@ def unpackb(object packed, object object_hook=None, object list_hook=None):
loads = unpacks = unpackb
-def unpack(object stream, object object_hook=None, object list_hook=None):
+def unpack(object stream, object object_hook=None, object list_hook=None, bint use_list=0):
"""unpack an object from stream."""
- return unpackb(stream.read(),
+ return unpackb(stream.read(), use_list=use_list,
object_hook=object_hook, list_hook=list_hook)
cdef class UnpackIterator(object):