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).
This commit is contained in:
@@ -155,12 +155,13 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset)
|
||||
{
|
||||
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 */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user