Author terry.reedy
Recipients Todd.Rovito, roger.serwy, terry.reedy
Date 2013-06-06.18:30:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Here is the 'OS' version of the fix and update to grep_it. Change 'OS' to 'IO' on line 17 to apply to current 3.3, without the io2os patch.  Besides using 'with', it iterates the files directly instead of iterating blocks of readlines. The two changes make the code simpler and cleaner. The changed summary looks better to me, besides avoiding the hit/hits problem.

As can be seen in the io2os patch, there are other opens to be updated in another patch.

OutputWindow.OutputWindow._file_line_helper has this one:
                    f = open(filename, "r")
which would become:
                    with open(filename, "r"): pass

This tests whether the filename extracted from a traceback or grep report is correct (can be opened). (Each of several patterns are tried until one works.) The opened file is discarded because the filename is returned to be passes to editwin's I believe this could be replaced by an os.stat() call.

Backportint to 2.7 is the subject of #18152
Date User Action Args
2013-06-06 18:30:43terry.reedysetrecipients: + terry.reedy, roger.serwy, Todd.Rovito
2013-06-06 18:30:43terry.reedysetmessageid: <>
2013-06-06 18:30:43terry.reedylinkissue18151 messages
2013-06-06 18:30:42terry.reedycreate