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>2011-09-27 08:07:48 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-09-27 08:07:48 +0400
commitd98bcb8a77c0a06dc35669dd8898f1f9f2ad85c6 (patch)
tree1eb80550c41ddb6238c5996d07af87259ab46ff3 /source/blender/python
parentf4dec97cef4b320c6f3ffd2ddc39d429da4fd4d5 (diff)
fix for py/rna api bug:
PyC_UnicodeAsByte(), used for getting python strings as bytes wasnt clearning utf-8 conversion errors. this would raise an error when getting an operators filepath.
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/generic/py_capi_utils.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index d5bd44fc288..17fda6d08a7 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -363,12 +363,15 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
* chars since blender doesnt limit this */
return result;
}
- else if(PyBytes_Check(py_str)) {
- PyErr_Clear();
- return PyBytes_AS_STRING(py_str);
- }
else {
- return PyBytes_AS_STRING((*coerce= PyUnicode_EncodeFSDefault(py_str)));
+ PyErr_Clear();
+
+ if(PyBytes_Check(py_str)) {
+ return PyBytes_AS_STRING(py_str);
+ }
+ else {
+ return PyBytes_AS_STRING((*coerce= PyUnicode_EncodeFSDefault(py_str)));
+ }
}
}