You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the existing issues and didn't find my bug already reported there
I have checked that my bug is still present in the latest release
cbor2 version
5.5.1
Python version
3.11.6
What happened?
Python Exceptions raised in the object_hook callback in cbor2.load are not propagated correctly in the C module, and result in this exception: "SystemError: returned a result with an exception set".
I would expect the original Python exceptions to be propagated up, matching the python implementation behavior.
How can we reproduce the bug?
import pytest
import cbor2
from cbor2._decoder import loads as loads_py
from _cbor2 import loads as loads_c
def dec_objhook(decoder, d):
raise TypeError("Unsupported type")
a = {
'a': 1,
'hello': 'world',
'test': {'foo': 'bar'}
}
test = cbor2.dumps(a)
with pytest.raises(TypeError):
loads_py(test, object_hook=dec_objhook)
with pytest.raises(TypeError):
loads_c(test, object_hook=dec_objhook)
The text was updated successfully, but these errors were encountered:
Things to check first
I have searched the existing issues and didn't find my bug already reported there
I have checked that my bug is still present in the latest release
cbor2 version
5.5.1
Python version
3.11.6
What happened?
Python Exceptions raised in the
object_hook
callback in cbor2.load are not propagated correctly in the C module, and result in this exception: "SystemError: returned a result with an exception set".I would expect the original Python exceptions to be propagated up, matching the python implementation behavior.
How can we reproduce the bug?
The text was updated successfully, but these errors were encountered: