Skip to content

Commit b2dbdc6

Browse files
committed
fix #31650 right use of string and bytes objects
1 parent e001710 commit b2dbdc6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/icu/icutrim.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def addTreeByType(tree, mytree):
285285
# read in the resource list for the tree
286286
treelistfile = os.path.join(options.tmpdir,"%s.lst" % tree)
287287
runcmd("iculslocs", "-i %s -N %s -T %s -l > %s" % (outfile, dataname, tree, treelistfile))
288-
fi = open(treelistfile, 'rb')
288+
fi = open(treelistfile, 'r')
289289
treeitems = fi.readlines()
290290
trees[tree]["locs"] = [treeitems[i].strip() for i in range(len(treeitems))]
291291
fi.close()
@@ -317,12 +317,12 @@ def removeList(count=0):
317317
erritems = fi.readlines()
318318
fi.close()
319319
#Item zone/zh_Hant_TW.res depends on missing item zone/zh_Hant.res
320-
pat = re.compile("""^Item ([^ ]+) depends on missing item ([^ ]+).*""")
320+
pat = re.compile(rb"^Item ([^ ]+) depends on missing item ([^ ]+).*")
321321
for i in range(len(erritems)):
322322
line = erritems[i].strip()
323323
m = pat.match(line)
324324
if m:
325-
toDelete = m.group(1)
325+
toDelete = m.group(1).decode("utf-8")
326326
if(options.verbose > 5):
327327
print("<< %s added to delete" % toDelete)
328328
remove.add(toDelete)

0 commit comments

Comments
 (0)