Fix display of SyntaxError when .py file is modified

As described on the mailing list, the line displayed with a SyntaxError can be incorrect, when editing and rerunning a file, due to stale caching. The line appears to be retrieved from the cache when the SyntaxError is created, which we can't influence, but we can replace it before we display the error, which is what this does.