Revision: 39714
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39714
Author:   campbellbarton
Date:     2011-08-26 17:55:03 +0000 (Fri, 26 Aug 2011)
Log Message:
-----------
fix for crash when running a python script in a non utf8 blend path, inspecting 
the exception for the path assumed utf8.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/armature/editarmature.c
    trunk/blender/source/blender/python/intern/bpy_traceback.c

Modified: trunk/blender/source/blender/editors/armature/editarmature.c
===================================================================
--- trunk/blender/source/blender/editors/armature/editarmature.c        
2011-08-26 17:45:22 UTC (rev 39713)
+++ trunk/blender/source/blender/editors/armature/editarmature.c        
2011-08-26 17:55:03 UTC (rev 39714)
@@ -518,7 +518,7 @@
                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;

Modified: trunk/blender/source/blender/python/intern/bpy_traceback.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_traceback.c  2011-08-26 
17:45:22 UTC (rev 39713)
+++ trunk/blender/source/blender/python/intern/bpy_traceback.c  2011-08-26 
17:55:03 UTC (rev 39714)
@@ -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 @@
                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;
                        }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to