Add support for bypassing pre-packed data

This commit is contained in:
Marco Ribeiro 2026-02-13 11:04:04 -03:00
parent f9806368ae
commit e4ec35b7d3
4 changed files with 21 additions and 3 deletions

View file

@ -38,7 +38,7 @@ else:
from .exceptions import BufferFull, ExtraData, FormatError, OutOfData, StackError
from .ext import ExtType, Timestamp
from .ext import Bypass, ExtType, Timestamp
EX_SKIP = 0
EX_CONSTRUCT = 1
@ -773,6 +773,9 @@ class Packer:
self._buffer.write(struct.pack("b", code))
self._buffer.write(data)
return
if check(obj, Bypass):
self._buffer.write(obj.data)
return
if check(obj, list_types):
n = len(obj)
self._pack_array_header(n)