mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-04-10 05:20:17 +00:00
Revert "Move unpack() from each implementation to __init__. (#286)"
This reverts commit da902f9c1d.
This commit is contained in:
parent
9bf38105f7
commit
9455fccc52
3 changed files with 39 additions and 14 deletions
|
|
@ -19,13 +19,13 @@ class ExtType(namedtuple('ExtType', 'code data')):
|
|||
|
||||
import os
|
||||
if os.environ.get('MSGPACK_PUREPYTHON'):
|
||||
from msgpack.fallback import Packer, unpackb, Unpacker
|
||||
from msgpack.fallback import Packer, unpack, unpackb, Unpacker
|
||||
else:
|
||||
try:
|
||||
from msgpack._packer import Packer
|
||||
from msgpack._unpacker import unpackb, Unpacker
|
||||
from msgpack._unpacker import unpack, unpackb, Unpacker
|
||||
except ImportError:
|
||||
from msgpack.fallback import Packer, unpackb, Unpacker
|
||||
from msgpack.fallback import Packer, unpack, unpackb, Unpacker
|
||||
|
||||
|
||||
def pack(o, stream, **kwargs):
|
||||
|
|
@ -46,17 +46,6 @@ def packb(o, **kwargs):
|
|||
"""
|
||||
return Packer(**kwargs).pack(o)
|
||||
|
||||
|
||||
def unpack(stream, **kwargs):
|
||||
"""
|
||||
Unpack an object from `stream`.
|
||||
|
||||
Raises `ExtraData` when `packed` contains extra bytes.
|
||||
See :class:`Unpacker` for options.
|
||||
"""
|
||||
return unpackb(stream.read(), **kwargs)
|
||||
|
||||
|
||||
# alias for compatibility to simplejson/marshal/pickle.
|
||||
load = unpack
|
||||
loads = unpackb
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue