mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-02-06 09:50:01 +00:00
Fix #285 again
This commit is contained in:
parent
3ca8eff31d
commit
fbaa1360be
1 changed files with 3 additions and 18 deletions
|
|
@ -211,30 +211,15 @@ def unpackb(object packed, object object_hook=None, object list_hook=None,
|
|||
raise UnpackValueError("Unpack failed: error = %d" % (ret,))
|
||||
|
||||
|
||||
def unpack(object stream, object object_hook=None, object list_hook=None,
|
||||
bint use_list=1, encoding=None, unicode_errors=None,
|
||||
object_pairs_hook=None, ext_hook=ExtType,
|
||||
Py_ssize_t max_str_len=2147483647, # 2**32-1
|
||||
Py_ssize_t max_bin_len=2147483647,
|
||||
Py_ssize_t max_array_len=2147483647,
|
||||
Py_ssize_t max_map_len=2147483647,
|
||||
Py_ssize_t max_ext_len=2147483647):
|
||||
def unpack(object stream, **kwargs):
|
||||
"""
|
||||
Unpack an object from `stream`.
|
||||
|
||||
Raises `ValueError` when `stream` has extra bytes.
|
||||
|
||||
See :class:`Unpacker` for options.
|
||||
"""
|
||||
return unpackb(stream.read(), use_list=use_list,
|
||||
object_hook=object_hook, object_pairs_hook=object_pairs_hook, list_hook=list_hook,
|
||||
encoding=encoding, unicode_errors=unicode_errors, ext_hook=ext_hook,
|
||||
max_str_len=max_str_len,
|
||||
max_bin_len=max_bin_len,
|
||||
max_array_len=max_array_len,
|
||||
max_map_len=max_map_len,
|
||||
max_ext_len=max_ext_len,
|
||||
)
|
||||
data = stream.read()
|
||||
return unpackb(data, **kwargs)
|
||||
|
||||
|
||||
cdef class Unpacker(object):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue