fix: re-raise existing exception when available

This commit is contained in:
Thomas Kowalski 2026-04-21 08:45:33 +02:00
parent 6357bc272c
commit 1cefcd551b
No known key found for this signature in database

View file

@ -205,7 +205,10 @@ def unpackb(object packed, *, object object_hook=None, object list_hook=None,
raise FormatError
elif ret == -3:
raise StackError
raise ValueError("Unpack failed: error = %d" % (ret,))
elif PyErr_Occurred():
raise
else:
raise ValueError("Unpack failed: error = %d" % (ret,))
cdef class Unpacker:
@ -481,6 +484,8 @@ cdef class Unpacker:
raise FormatError
elif ret == -3:
raise StackError
elif PyErr_Occurred():
raise
else:
raise ValueError("Unpack failed: error = %d" % (ret,))