mirror of
https://github.com/python/cpython.git
synced 2025-07-19 01:05:26 +00:00
Fix EncodingWarning in test_tools. (GH-28846)
This commit is contained in:
parent
3d1ca867ed
commit
a1c3c9e824
7 changed files with 29 additions and 25 deletions
|
@ -24,7 +24,7 @@ trailer = """\
|
|||
"""
|
||||
|
||||
def add_escapes(filename):
|
||||
with open(filename) as fp:
|
||||
with open(filename, encoding="utf-8") as fp:
|
||||
for line in fp:
|
||||
yield html.escape(line)
|
||||
|
||||
|
@ -79,7 +79,7 @@ def main():
|
|||
filename = sys.argv[1]
|
||||
outputfilename = filename + ".html"
|
||||
input = add_escapes(filename)
|
||||
with open(outputfilename, "w") as output:
|
||||
with open(outputfilename, "w", encoding="utf-8") as output:
|
||||
gprof2html(input, output, filename)
|
||||
webbrowser.open("file:" + os.path.abspath(outputfilename))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue