Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 776c0df

Browse files
committed
#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.
1 parent d70846b commit 776c0df

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

Tools/scripts/gprof2html.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,19 @@
1919
</html>
2020
"""
2121

22-
def add_escapes(input):
23-
for line in input:
24-
yield cgi.escape(line)
22+
def add_escapes(filename):
23+
with open(filename) as fp:
24+
for line in fp:
25+
yield cgi.escape(line)
26+
2527

2628
def main():
2729
filename = "gprof.out"
2830
if sys.argv[1:]:
2931
filename = sys.argv[1]
3032
outputfilename = filename + ".html"
31-
input = add_escapes(file(filename))
32-
output = file(outputfilename, "w")
33+
input = add_escapes(filename)
34+
output = open(outputfilename, "w")
3335
output.write(header % filename)
3436
for line in input:
3537
output.write(line)

0 commit comments

Comments
 (0)