-
Notifications
You must be signed in to change notification settings - Fork 68
Open
Labels
Description
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.6.5
Python version
Python 3.10.14
What happened?
The str_errors kwarg is no longer working as expected since 5.6.0:
When passing str_errors="replace", bytes that failed to decode, should be replaced with a replacement character. Instead, CBORDecodeValueError is always raised.
How can we reproduce the bug?
Before 5.6.0 (e.g. 5.5.1):
>>> cbor2.loads(b"cfo\x90", str_errors="replace")
'fo�'
Since 5.6.0:
>>> cbor2.loads(b"cfo\x90", str_errors="replace")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 2: invalid start byte
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
_cbor2.CBORDecodeValueError: error decoding unicode string
topher200