Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-07-31 09:52:44 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-07-31 09:52:44 +0300
commit2dfc954c4a552f80f8e944c3b6a1a7b6995427a2 (patch)
tree494c314e942a53279cd463caa17d8a77f76c63c5 /source/blender/python/generic/idprop_py_api.c
parent409316434c42363b5c64c4ce58690d273f61f56e (diff)
PyAPI: Add PyC_UnicodeAsByteAndSize
Read the string length from Python directly when assigning id-properties
Diffstat (limited to 'source/blender/python/generic/idprop_py_api.c')
-rw-r--r--source/blender/python/generic/idprop_py_api.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
index fe4a63e1e3d..c978ae55ea6 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -378,8 +378,10 @@ bool BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty *group,
}
else if (PyUnicode_Check(ob)) {
#ifdef USE_STRING_COERCE
+ Py_ssize_t value_size;
PyObject *value_coerce = NULL;
- val.string.str = PyC_UnicodeAsByte(ob, &value_coerce);
+ val.string.str = PyC_UnicodeAsByteAndSize(ob, &value_size, &value_coerce);
+ val.string.len = (int)value_size + 1;
val.string.subtype = IDP_STRING_SUB_UTF8;
prop = IDP_New(IDP_STRING, &val, name);
Py_XDECREF(value_coerce);