mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-11-03 02:50:55 +00:00
Add docstring about raising ValueError when there are extra bytes.
This commit is contained in:
parent
e8842efded
commit
c3da845868
1 changed files with 7 additions and 3 deletions
|
|
@ -217,8 +217,10 @@ cdef extern from "unpack.h":
|
||||||
def unpackb(object packed, object object_hook=None, object list_hook=None,
|
def unpackb(object packed, object object_hook=None, object list_hook=None,
|
||||||
bint use_list=0, encoding=None, unicode_errors="strict",
|
bint use_list=0, encoding=None, unicode_errors="strict",
|
||||||
):
|
):
|
||||||
|
"""Unpack packed_bytes to object. Returns an unpacked object.
|
||||||
|
|
||||||
|
Raises `ValueError` when `packed` contains extra bytes.
|
||||||
"""
|
"""
|
||||||
Unpack packed_bytes to object. Returns an unpacked object."""
|
|
||||||
cdef template_context ctx
|
cdef template_context ctx
|
||||||
cdef size_t off = 0
|
cdef size_t off = 0
|
||||||
cdef int ret
|
cdef int ret
|
||||||
|
|
@ -268,14 +270,16 @@ def unpackb(object packed, object object_hook=None, object list_hook=None,
|
||||||
def unpack(object stream, object object_hook=None, object list_hook=None,
|
def unpack(object stream, object object_hook=None, object list_hook=None,
|
||||||
bint use_list=0, encoding=None, unicode_errors="strict",
|
bint use_list=0, encoding=None, unicode_errors="strict",
|
||||||
):
|
):
|
||||||
"""
|
"""Unpack an object from `stream`.
|
||||||
unpack an object from stream.
|
|
||||||
|
Raises `ValueError` when `stream` has extra bytes.
|
||||||
"""
|
"""
|
||||||
return unpackb(stream.read(), use_list=use_list,
|
return unpackb(stream.read(), use_list=use_list,
|
||||||
object_hook=object_hook, list_hook=list_hook,
|
object_hook=object_hook, list_hook=list_hook,
|
||||||
encoding=encoding, unicode_errors=unicode_errors,
|
encoding=encoding, unicode_errors=unicode_errors,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
cdef class Unpacker(object):
|
cdef class Unpacker(object):
|
||||||
"""
|
"""
|
||||||
Streaming unpacker.
|
Streaming unpacker.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue