@@ -217,8 +217,10 @@ cdef extern from "unpack.h":
217
217
def unpackb (object packed , object object_hook = None , object list_hook = None ,
218
218
bint use_list = 0 , encoding = None , unicode_errors = " strict" ,
219
219
):
220
+ """ Unpack packed_bytes to object. Returns an unpacked object.
221
+
222
+ Raises `ValueError` when `packed` contains extra bytes.
220
223
"""
221
- Unpack packed_bytes to object. Returns an unpacked object."""
222
224
cdef template_context ctx
223
225
cdef size_t off = 0
224
226
cdef int ret
@@ -268,14 +270,16 @@ def unpackb(object packed, object object_hook=None, object list_hook=None,
268
270
def unpack (object stream , object object_hook = None , object list_hook = None ,
269
271
bint use_list = 0 , encoding = None , unicode_errors = " strict" ,
270
272
):
271
- """
272
- unpack an object from stream.
273
+ """ Unpack an object from `stream`.
274
+
275
+ Raises `ValueError` when `stream` has extra bytes.
273
276
"""
274
277
return unpackb(stream.read(), use_list = use_list,
275
278
object_hook = object_hook, list_hook = list_hook,
276
279
encoding = encoding, unicode_errors = unicode_errors,
277
280
)
278
281
282
+
279
283
cdef class Unpacker(object ):
280
284
"""
281
285
Streaming unpacker.
0 commit comments