mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-06-28 03:30:24 +00:00
Add missing autoreset in Packer.pack_ext_type (#663)
This commit is contained in:
parent
4a07745675
commit
284782d647
4 changed files with 25 additions and 1 deletions
|
|
@ -291,6 +291,10 @@ cdef class Packer:
|
|||
raise ValueError("ext data too large")
|
||||
msgpack_pack_ext(&self.pk, typecode, len(data))
|
||||
msgpack_pack_raw_body(&self.pk, data, len(data))
|
||||
if self.autoreset:
|
||||
buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length)
|
||||
self.pk.length = 0
|
||||
return buf
|
||||
|
||||
@cython.critical_section
|
||||
def pack_array_header(self, long long size):
|
||||
|
|
|
|||
|
|
@ -867,6 +867,10 @@ class Packer:
|
|||
self._buffer.write(b"\xc9" + struct.pack(">I", L))
|
||||
self._buffer.write(struct.pack("B", typecode))
|
||||
self._buffer.write(data)
|
||||
if self._autoreset:
|
||||
ret = self._buffer.getvalue()
|
||||
self._buffer = BytesIO()
|
||||
return ret
|
||||
|
||||
def _pack_array_header(self, n):
|
||||
if n <= 0x0F:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue