Message85663
On a second look:
1. the code in OutputWindow.py for the 'goto' action looks for a match
with the first regex in
file_line_pats = [
r'file "([^"]*)", line (\d+)',
r'([^\s]+)\((\d+)\)',
r'([^\s]+):\s*(\d+):',
]
and it assumes the first group gives a valid filename, the second a
line number.
2. the potential target lines produced by GrepDialog.py are writen by:
sys.stdout.write("%s: %s: %s\n" % (fn, lineno, line))
where:
fn :a valid filename ( because an open(fn) was issued before), not
guaranted an abspath
lineno : unsigned int
line: a text line in an arbitrary file, but mostly an *.py
Clearly the 3rd regex is the only one that can hit the line produced by
GrepDialog, and clearly will fail in any OS that allows spaces in a
valid path: the regex breaks the first group at the first whitespace.
The tentative fix propossed in the initial post was a minimal change
that allow spaces in the path, but was very ugly and not comunicates a
clear intention.
I like more:
r'(?:\s*)(.+):\s+(\d+):'
wich discards leading whitespace ( feature unused by GrepDialog but
probably handy in pyShell, wich subclasses OutputWindow )
It is a better regex that the original in IDLE, meaning it would hit
more positives, but can fail sometimes:
Supose the GrepDialog found a hit at line 111 in the file c:\foo.py ,
with the text
a = 1 # see 24: 32: 1
The line sent to OutputWindow would be
c:\foo.py: 111: a = 1 # see 24: 32: 1
and the regex will capture the groups:
filename = "c:\foo.py: 111: a = 1 # see 24"
linenum = "32"
The first group fails to capture the filename.
I can live with such special case failures, but anyway:
In windows, changing the regex to break the first group at the
first ': ' would fix the thing ( ': ' cant happen in a fn that pass open
(fn) )
How about other OSes ?
------ |
|
Date |
User |
Action |
Args |
2009-04-06 19:01:42 | ccanepa | set | recipients:
+ ccanepa, gpolo |
2009-04-06 19:01:42 | ccanepa | set | messageid: <1239044502.61.0.857554957083.issue5559@psf.upfronthosting.co.za> |
2009-04-06 19:01:41 | ccanepa | link | issue5559 messages |
2009-04-06 19:01:39 | ccanepa | create | |
|