Skip to content

Commit 1cefcd5

Browse files
fix: re-raise existing exception when available
1 parent 6357bc2 commit 1cefcd5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

msgpack/_unpacker.pyx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,10 @@ def unpackb(object packed, *, object object_hook=None, object list_hook=None,
205205
raise FormatError
206206
elif ret == -3:
207207
raise StackError
208-
raise ValueError("Unpack failed: error = %d" % (ret,))
208+
elif PyErr_Occurred():
209+
raise
210+
else:
211+
raise ValueError("Unpack failed: error = %d" % (ret,))
209212

210213

211214
cdef class Unpacker:
@@ -481,6 +484,8 @@ cdef class Unpacker:
481484
raise FormatError
482485
elif ret == -3:
483486
raise StackError
487+
elif PyErr_Occurred():
488+
raise
484489
else:
485490
raise ValueError("Unpack failed: error = %d" % (ret,))
486491

0 commit comments

Comments
 (0)