File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ def generate():
8989 7 * 4 , # start of key index
9090 7 * 4 + len (keys )* 8 , # start of value index
9191 0 , 0 ) # size and offset of hash table
92- output += array .array ("i" , offsets ).tostring ()
92+ output += array .array ("i" , offsets ).tobytes ()
9393 output += ids
9494 output += strs
9595 return output
@@ -109,7 +109,8 @@ def make(filename, outfile):
109109 outfile = os .path .splitext (infile )[0 ] + '.mo'
110110
111111 try :
112- lines = open (infile , 'rb' ).readlines ()
112+ with open (infile , 'rb' ) as f :
113+ lines = f .readlines ()
113114 except IOError as msg :
114115 print (msg , file = sys .stderr )
115116 sys .exit (1 )
@@ -199,7 +200,8 @@ def make(filename, outfile):
199200 output = generate ()
200201
201202 try :
202- open (outfile ,"wb" ).write (output )
203+ with open (outfile ,"wb" ) as f :
204+ f .write (output )
203205 except IOError as msg :
204206 print (msg , file = sys .stderr )
205207
You can’t perform that action at this time.
0 commit comments