diff options
author | Antonio Cuni <anto.cuni@gmail.com> | 2013-10-18 17:33:54 +0200 |
---|---|---|
committer | Antonio Cuni <anto.cuni@gmail.com> | 2013-10-18 17:33:54 +0200 |
commit | 5467515065b95496b9f5b9d842ffc73c9ccb806e (patch) | |
tree | 27bfb8233e5b8aa63b76492337995578de9ab623 /msgpack/_packer.pyx | |
parent | afa28fb2051cb00f03c83e020745e1eb238ff4ac (diff) | |
download | msgpack-python-5467515065b95496b9f5b9d842ffc73c9ccb806e.tar.gz |
implement Packer.pack_extended_type also in the cython version of the code
Diffstat (limited to 'msgpack/_packer.pyx')
-rw-r--r-- | msgpack/_packer.pyx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/msgpack/_packer.pyx b/msgpack/_packer.pyx index 6289192..985559c 100644 --- a/msgpack/_packer.pyx +++ b/msgpack/_packer.pyx @@ -5,6 +5,7 @@ from cpython cimport * from libc.stdlib cimport * from libc.string cimport * from libc.limits cimport * +from libc.stdint cimport int8_t from msgpack.exceptions import PackValueError @@ -27,6 +28,7 @@ cdef extern from "pack.h": int msgpack_pack_map(msgpack_packer* pk, size_t l) int msgpack_pack_raw(msgpack_packer* pk, size_t l) int msgpack_pack_raw_body(msgpack_packer* pk, char* body, size_t l) + int msgpack_pack_ext(msgpack_packer* pk, int8_t typecode, size_t l) cdef int DEFAULT_RECURSE_LIMIT=511 @@ -193,6 +195,10 @@ cdef class Packer(object): self.pk.length = 0 return buf + def pack_extended_type(self, typecode, data): + msgpack_pack_ext(&self.pk, typecode, len(data)) + msgpack_pack_raw_body(&self.pk, data, len(data)) + def pack_array_header(self, size_t size): cdef int ret = msgpack_pack_array(&self.pk, size) if ret == -1: |