diff options
author | R David Murray <rdmurray@bitdance.com> | 2012-04-11 19:16:38 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2012-04-11 19:16:38 (GMT) |
commit | 776c0df42bbcf7060c49954378bfd1185a20c050 (patch) | |
tree | f1a0405f9fc04e689e3d6f497c5682f72d43b373 /Tools | |
parent | d70846b1b176eb28c37e4b4bbffdbf6bf8592fd8 (diff) | |
download | cpython-776c0df42bbcf7060c49954378bfd1185a20c050.zip cpython-776c0df42bbcf7060c49954378bfd1185a20c050.tar.gz cpython-776c0df42bbcf7060c49954378bfd1185a20c050.tar.bz2 |
#14508: make gprof2html script runnable under python3
Not that I haven't tested it to make sure it works, just that it
can run against an empty source file.
Initial patch by Popa.Claudiu.
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/scripts/gprof2html.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Tools/scripts/gprof2html.py b/Tools/scripts/gprof2html.py index f3c7202..6c899d9 100755 --- a/Tools/scripts/gprof2html.py +++ b/Tools/scripts/gprof2html.py @@ -19,17 +19,19 @@ trailer = """\ </html> """ -def add_escapes(input): - for line in input: - yield cgi.escape(line) +def add_escapes(filename): + with open(filename) as fp: + for line in fp: + yield cgi.escape(line) + def main(): filename = "gprof.out" if sys.argv[1:]: filename = sys.argv[1] outputfilename = filename + ".html" - input = add_escapes(file(filename)) - output = file(outputfilename, "w") + input = add_escapes(filename) + output = open(outputfilename, "w") output.write(header % filename) for line in input: output.write(line) |