Allow conversion of any unicode sequence into a QString

This commit is contained in:
AnyOldName3
2018-03-16 00:32:21 +00:00
parent c6e8a223e1
commit 10437e0aca
+6 -1
View File
@@ -112,8 +112,13 @@ struct QString_from_python_str
}
static void construct(PyObject *objPtr, bpy::converter::rvalue_from_python_stage1_data *data) {
// Ensure the string uses 8-bit characters
PyObject *strPtr = PyUnicode_Check(objPtr) ? PyUnicode_AsUTF8String(objPtr) : objPtr;
// Extract the character data from the python string
const char* value = PyString_AsString(objPtr);
const char* value = PyString_AsString(strPtr);
// Deallocate local copy if one was made
if (strPtr != objPtr)
Py_DecRef(strPtr);
assert(value != nullptr);
// allocate storage