This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ccanepa
Recipients ccanepa, gpolo
Date 2009-04-06.19:01:39
SpamBayes Score 1.21569e-14
Marked as misclassified No
Message-id <>
On a second look:

1. the code in for the 'goto' action looks for a match 
with the first regex in
    file_line_pats = [
        r'file "([^"]*)", line (\d+)',
and it assumes the first group gives a valid filename, the second a 
line number. 

2. the potential target lines produced by are writen by:
sys.stdout.write("%s: %s: %s\n" % (fn, lineno, line)) 

  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:
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:\ , 
with the text
a = 1 # see 24: 32: 1

The line sent to OutputWindow would be
c:\ 111: a = 1 # see 24: 32: 1

and the regex will capture the groups:
filename = "c:\ 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:42ccanepasetrecipients: + ccanepa, gpolo
2009-04-06 19:01:42ccanepasetmessageid: <>
2009-04-06 19:01:41ccanepalinkissue5559 messages
2009-04-06 19:01:39ccanepacreate