reraising ValueError from unpack.h as UnpackValueError
This commit is contained in:
parent
d44063119b
commit
1183eff688
|
@ -397,6 +397,7 @@ cdef class Unpacker(object):
|
|||
else:
|
||||
raise OutOfData("No more data to unpack.")
|
||||
|
||||
try:
|
||||
ret = execute(&self.ctx, self.buf, self.buf_tail, &self.buf_head)
|
||||
if write_bytes is not None:
|
||||
write_bytes(PyBytes_FromStringAndSize(self.buf + prev_head, self.buf_head - prev_head))
|
||||
|
@ -414,7 +415,9 @@ cdef class Unpacker(object):
|
|||
else:
|
||||
raise OutOfData("No more data to unpack.")
|
||||
else:
|
||||
raise ValueError("Unpack failed: error = %d" % (ret,))
|
||||
raise UnpackValueError("Unpack failed: error = %d" % (ret,))
|
||||
except ValueError as e:
|
||||
raise UnpackValueError(e)
|
||||
|
||||
def read_bytes(self, Py_ssize_t nbytes):
|
||||
"""Read a specified number of raw bytes from the stream"""
|
||||
|
|
Loading…
Reference in New Issue