Skip to content

Commit

Permalink
Adjust error line parsing for newer Python versions
Browse files Browse the repository at this point in the history
The format of the error message output of the py_compile module has changed in
Python 2.6. The code now tries to detect the format and parse it accordingly.
  • Loading branch information
eht16 committed Oct 18, 2011
1 parent cf88abf commit 90cf307
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/msgwindow.c
Original file line number Diff line number Diff line change
Expand Up @@ -844,11 +844,25 @@ static void parse_compiler_error_line(const gchar *string,
case GEANY_FILETYPES_PYTHON:
{
/* File "HyperArch.py", line 37, in ?
* (file "clrdial.tcl" line 12) */
data.pattern = " \"";
data.min_fields = 6;
data.line_idx = 5;
data.file_idx = 2;
* (file "clrdial.tcl" line 12)
* */
if (strstr(string, " line ") != NULL)
{
/* Tcl and old Python format (<= Python 2.5) */
data.pattern = " \"";
data.min_fields = 6;
data.line_idx = 5;
data.file_idx = 2;
}
else
{
/* SyntaxError: ('invalid syntax', ('sender.py', 149, 20, ' ...'))
* (used since Python 2.6) */
data.pattern = ",'";
data.min_fields = 8;
data.line_idx = 6;
data.file_idx = 4;
}
break;
}
case GEANY_FILETYPES_BASIC:
Expand Down

0 comments on commit 90cf307

Please sign in to comment.