diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-08-26 21:55:03 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-08-26 21:55:03 +0400 |
commit | 8a619a3eee0775d338e41763b219d661a6845dea (patch) | |
tree | e800e7755515491f3c7bb15e9fffd09c5beef084 | |
parent | 1439ddccae91898812b3a040b35dedcb639894e5 (diff) |
fix for crash when running a python script in a non utf8 blend path, inspecting the exception for the path assumed utf8.
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 2 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_traceback.c | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 451154ce842..08f313bfadd 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -518,7 +518,7 @@ void ED_armature_apply_transform(Object *ob, float mat[4][4]) mul_m4_v3(mat, ebone->tail); /* apply the transfiormed roll back */ - mat3_to_vec_roll(tmat, delta, &ebone->roll); + mat3_to_vec_roll(tmat, NULL, &ebone->roll); ebone->rad_head *= scale; ebone->rad_tail *= scale; diff --git a/source/blender/python/intern/bpy_traceback.c b/source/blender/python/intern/bpy_traceback.c index 17f082b79dc..747a876d6df 100644 --- a/source/blender/python/intern/bpy_traceback.c +++ b/source/blender/python/intern/bpy_traceback.c @@ -30,9 +30,9 @@ #include "bpy_traceback.h" -static const char *traceback_filepath(PyTracebackObject *tb) +static const char *traceback_filepath(PyTracebackObject *tb, PyObject **coerce) { - return _PyUnicode_AsString(tb->tb_frame->f_code->co_filename); + return PyBytes_AS_STRING((*coerce= PyUnicode_EncodeFSDefault(tb->tb_frame->f_code->co_filename))); } /* copied from pythonrun.c, 3.2.0 */ @@ -146,7 +146,12 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset) PyErr_Print(); for(tb= (PyTracebackObject *)PySys_GetObject("last_traceback"); tb && (PyObject *)tb != Py_None; tb= tb->tb_next) { - if(strcmp(traceback_filepath(tb), filepath) != 0) { + PyObject *coerce; + const char *tb_filepath= traceback_filepath(tb, &coerce); + const int match= strcmp(tb_filepath, filepath) != 0; + Py_DECREF(coerce); + + if(match) { *lineno= tb->tb_lineno; break; } |