Python3 compatibility: use open() instead of file()

For details see: https://python-future.org/compatible_idioms.html#file


Bug: chromium:948824
Change-Id: Ib06568963073621bd8edf2c8edb89bf8253d3bcb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1549169
Reviewed-by: Sergiy Belozorov <sergiyb@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Sergiy Belozorov <sergiyb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60660}
This commit is contained in:
Vadim Gorbachev 2019-04-02 22:45:57 +03:00 committed by Commit Bot
parent d88f4d33c2
commit 7cf4add6ca

View File

@ -27,13 +27,13 @@ BINUTILS_OUT = 'Release'
def ReadFile(filename):
with file(filename, 'r') as f:
with open(filename, 'r') as f:
return f.read().strip()
def WriteFile(filename, content):
assert not os.path.exists(filename)
with file(filename, 'w') as f:
with open(filename, 'w') as f:
f.write(content)
f.write('\n')