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:
Diffstat (limited to 'source/blender/python/generic/py_capi_utils.c')
-rw-r--r--source/blender/python/generic/py_capi_utils.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index 575495e186e..587ac69071e 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -386,9 +386,9 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
}
}
-PyObject *PyC_UnicodeFromByte(const char *str)
+PyObject *PyC_UnicodeFromByteAndSize(const char *str, Py_ssize_t size)
{
- PyObject *result= PyUnicode_FromString(str);
+ PyObject *result= PyUnicode_FromStringAndSize(str, size);
if (result) {
/* 99% of the time this is enough but we better support non unicode
* chars since blender doesnt limit this */
@@ -397,11 +397,16 @@ PyObject *PyC_UnicodeFromByte(const char *str)
else {
PyErr_Clear();
/* this means paths will always be accessible once converted, on all OS's */
- result= PyUnicode_DecodeFSDefault(str);
+ result= PyUnicode_DecodeFSDefaultAndSize(str, size);
return result;
}
}
+PyObject *PyC_UnicodeFromByte(const char *str)
+{
+ return PyC_UnicodeFromByteAndSize(str, strlen(str));
+}
+
/*****************************************************************************
* Description: This function creates a new Python dictionary object.
* note: dict is owned by sys.modules["__main__"] module, reference is borrowed