mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-04-11 05:40:20 +00:00
Add support for bypassing pre-packed data
This commit is contained in:
parent
f9806368ae
commit
e4ec35b7d3
4 changed files with 21 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue