summaryrefslogtreecommitdiff
path: root/msgpack/_unpacker.pyx
diff options
context:
space:
mode:
authorINADA Naoki <inada-n@klab.com>2012-12-29 01:43:16 +0900
committerINADA Naoki <inada-n@klab.com>2012-12-29 01:43:16 +0900
commitd57e369258a388ee64ad900ee7e975da25ca36ec (patch)
tree32988fcd362d9cac3a6c31c9f16d94d0dac6d732 /msgpack/_unpacker.pyx
parent7b11a42825a631ba85608a3c0943919073d9899e (diff)
parent72416e403c6d70b6fbc4ea8e05e1fe7f02a6561a (diff)
downloadmsgpack-python-d57e369258a388ee64ad900ee7e975da25ca36ec.tar.gz
Fix unpacker doesn't raise exception for invalid input (Merge branch '0.2'
Fixes #40 Conflicts: ChangeLog.rst msgpack/_unpacker.pyx msgpack/_version.py
Diffstat (limited to 'msgpack/_unpacker.pyx')
-rw-r--r--msgpack/_unpacker.pyx4
1 files changed, 3 insertions, 1 deletions
diff --git a/msgpack/_unpacker.pyx b/msgpack/_unpacker.pyx
index 4a27d9e..b83a6e4 100644
--- a/msgpack/_unpacker.pyx
+++ b/msgpack/_unpacker.pyx
@@ -38,7 +38,7 @@ cdef extern from "unpack.h":
PyObject* key
ctypedef int (*execute_fn)(template_context* ctx, const_char_ptr data,
- size_t len, size_t* off) except -1
+ size_t len, size_t* off) except? -1
execute_fn template_construct
execute_fn template_skip
execute_fn read_array_header
@@ -113,6 +113,8 @@ def unpackb(object packed, object object_hook=None, object list_hook=None,
if off < buf_len:
raise ExtraData(obj, PyBytes_FromStringAndSize(buf+off, buf_len-off))
return obj
+ elif ret < 0:
+ raise ValueError("Unpack failed: error = %d" % (ret,))
else:
raise UnpackValueError