[Python-checkins] [3.7] bpo-34166: Fix warnings in Tools/msgfmt.py. (GH-8367) (GH-8369)
Serhiy Storchaka
webhook-mailer at python.org
Sat Jul 21 03:25:07 EDT 2018
https://github.com/python/cpython/commit/25326dea8b907fdd2bf087baab3c31b617438f2e
commit: 25326dea8b907fdd2bf087baab3c31b617438f2e
branch: 3.7
author: Xtreak <tirkarthi at users.noreply.github.com>
committer: Serhiy Storchaka <storchaka at gmail.com>
date: 2018-07-21T10:25:03+03:00
summary:
[3.7] bpo-34166: Fix warnings in Tools/msgfmt.py. (GH-8367) (GH-8369)
(cherry picked from commit a692efe4733f98831cb51a9683877b152f754d14)
Co-authored-by: Xtreak <tirkarthi at users.noreply.github.com>
files:
M Tools/i18n/msgfmt.py
diff --git a/Tools/i18n/msgfmt.py b/Tools/i18n/msgfmt.py
index b0751a1ffc1d..63d52d1f46e5 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)
More information about the Python-checkins
mailing list