mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-02-13 19:04:16 +00:00
Packer.pack_array/map_header to correspond to read functions
This commit is contained in:
parent
0431a766f4
commit
9d9c3eecb8
2 changed files with 40 additions and 0 deletions
|
|
@ -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'):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue