add autoreset support to Packer.pack_ext_type()

This commit is contained in:
Inada Naoki 2026-06-01 18:55:47 +09:00
parent b691a8e52c
commit 1406cd49cc

View file

@ -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):