diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-07-21 07:24:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-21 07:24:41 (GMT) |
commit | 916bcc6fde2db95199454b22f608648467fbbc54 (patch) | |
tree | 92c2713ff393fd4f631c997f1d0e1619dcbdbf5f /Tools | |
parent | 917696242b2d1c7cf4cba660fa6a29c30667e6da (diff) | |
download | cpython-916bcc6fde2db95199454b22f608648467fbbc54.zip cpython-916bcc6fde2db95199454b22f608648467fbbc54.tar.gz cpython-916bcc6fde2db95199454b22f608648467fbbc54.tar.bz2 |
bpo-34166: Fix warnings in Tools/msgfmt.py. (GH-8367)
(cherry picked from commit a692efe4733f98831cb51a9683877b152f754d14)
Co-authored-by: Xtreak <tirkarthi@users.noreply.github.com>
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/i18n/msgfmt.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Tools/i18n/msgfmt.py b/Tools/i18n/msgfmt.py index b0751a1..63d52d1 100755 --- a/Tools/i18n/msgfmt.py +++ b/Tools/i18n/msgfmt.py @@ -89,7 +89,7 @@ def generate(): 7*4, # start of key index 7*4+len(keys)*8, # start of value index 0, 0) # size and offset of hash table - output += array.array("i", offsets).tostring() + output += array.array("i", offsets).tobytes() output += ids output += strs return output @@ -109,7 +109,8 @@ def make(filename, outfile): outfile = os.path.splitext(infile)[0] + '.mo' try: - lines = open(infile, 'rb').readlines() + with open(infile, 'rb') as f: + lines = f.readlines() except IOError as msg: print(msg, file=sys.stderr) sys.exit(1) @@ -199,7 +200,8 @@ def make(filename, outfile): output = generate() try: - open(outfile,"wb").write(output) + with open(outfile,"wb") as f: + f.write(output) except IOError as msg: print(msg, file=sys.stderr) |