diff options
author | Joel Nothman <joel.nothman@gmail.com> | 2012-09-23 17:26:16 +1000 |
---|---|---|
committer | Joel Nothman <joel.nothman@gmail.com> | 2012-09-25 01:19:10 +1000 |
commit | 9d9c3eecb846c6a927a31aae394dea39fa75aef4 (patch) | |
tree | 81fd5258a8809b117146e2fd128a18a13a1e4087 /msgpack/_msgpack.pyx | |
parent | 0431a766f4e069d74627441aa3facbc7e64e4511 (diff) | |
download | msgpack-python-9d9c3eecb846c6a927a31aae394dea39fa75aef4.tar.gz |
Packer.pack_array/map_header to correspond to read functions
Diffstat (limited to 'msgpack/_msgpack.pyx')
-rw-r--r-- | msgpack/_msgpack.pyx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/msgpack/_msgpack.pyx b/msgpack/_msgpack.pyx index 7131d1f..18a75ca 100644 --- a/msgpack/_msgpack.pyx +++ b/msgpack/_msgpack.pyx @@ -178,6 +178,17 @@ cdef class Packer(object): self.pk.length = 0 return buf + cpdef pack_array_header(self, size_t size): + msgpack_pack_array(&self.pk, size) + buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length) + self.pk.length = 0 + return buf + + cpdef pack_map_header(self, size_t size): + msgpack_pack_map(&self.pk, size) + buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length) + self.pk.length = 0 + return buf def pack(object o, object stream, default=None, encoding='utf-8', unicode_errors='strict'): """ |