dcparser: Improve assertion error message for invalid UTF-8 data

This commit is contained in:
rdb 2021-10-26 13:55:47 +02:00
parent cd9712270b
commit ca061c98a6

View File

@ -889,6 +889,10 @@ unpack_object() {
unpack_string(str);
#if PY_MAJOR_VERSION >= 3
object = PyUnicode_FromStringAndSize(str.data(), str.size());
if (object == nullptr) {
nassert_raise("Unable to decode UTF-8 string; use blob type for binary data");
return nullptr;
}
#else
object = PyString_FromStringAndSize(str.data(), str.size());
#endif