mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-27 15:25:54 -04:00
dcparser: Improve assertion error message for invalid UTF-8 data
This commit is contained in:
parent
cd9712270b
commit
ca061c98a6
@ -889,6 +889,10 @@ unpack_object() {
|
|||||||
unpack_string(str);
|
unpack_string(str);
|
||||||
#if PY_MAJOR_VERSION >= 3
|
#if PY_MAJOR_VERSION >= 3
|
||||||
object = PyUnicode_FromStringAndSize(str.data(), str.size());
|
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
|
#else
|
||||||
object = PyString_FromStringAndSize(str.data(), str.size());
|
object = PyString_FromStringAndSize(str.data(), str.size());
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user