Visitar URL original
Add missing autoreset in Packer.pack_ext_type by bysiber · Pull Request #663 · msgpack/msgpack-python · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add autoreset support to Packer.pack_ext_type()
  • Loading branch information
methane committed Jun 1, 2026
commit 1406cd49ccc275ec15b8e42130fa5ed46e5f81ef
4 changes: 4 additions & 0 deletions msgpack/_packer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down