[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45278] trunk/blender/source/blender/ python/intern/bpy_traceback.c: fix for finding the python exception line number when running a script in the text editor .

Campbell Barton ideasman42 at gmail.com
Fri Mar 30 07:26:20 CEST 2012


Revision: 45278
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45278
Author:   campbellbarton
Date:     2012-03-30 05:26:08 +0000 (Fri, 30 Mar 2012)
Log Message:
-----------
fix for finding the python exception line number when running a script in the text editor.

- filename comparison was invalid
- was stopping on the first traceback, which would reference the caller but not the error line (when the error was in a function).

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

Modified: trunk/blender/source/blender/python/intern/bpy_traceback.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_traceback.c	2012-03-30 03:33:42 UTC (rev 45277)
+++ trunk/blender/source/blender/python/intern/bpy_traceback.c	2012-03-30 05:26:08 UTC (rev 45278)
@@ -155,12 +155,13 @@
 		{
 			PyObject *coerce;
 			const char *tb_filepath = traceback_filepath(tb, &coerce);
-			const int match = BLI_path_cmp(tb_filepath, filepath) != 0;
+			const int match = ((BLI_path_cmp(tb_filepath, filepath) == 0) ||
+			                   ((tb_filepath[0] == '\\' || tb_filepath[0] == '/') && BLI_path_cmp(tb_filepath + 1, filepath) == 0));
 			Py_DECREF(coerce);
 
 			if (match) {
 				*lineno = tb->tb_lineno;
-				break;
+				/* used to break here, but better find the inner most line */
 			}
 		}
 	}




More information about the Bf-blender-cvs mailing list