Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9600f93

Browse files
committed
Make gettext work with strict str/bytes.
1 parent 83800a6 commit 9600f93

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Lib/gettext.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def _parse(self, fp):
292292
if mlen == 0:
293293
# Catalog description
294294
lastk = k = None
295-
for b_item in tmsg.split(os.linesep):
295+
for b_item in tmsg.split(os.linesep.encode("ascii")):
296296
item = str(b_item).strip()
297297
if not item:
298298
continue
@@ -321,8 +321,8 @@ def _parse(self, fp):
321321
# if the Unicode conversion fails.
322322
if b'\x00' in msg:
323323
# Plural forms
324-
msgid1, msgid2 = msg.split('\x00')
325-
tmsg = tmsg.split('\x00')
324+
msgid1, msgid2 = msg.split(b'\x00')
325+
tmsg = tmsg.split(b'\x00')
326326
if self._charset:
327327
msgid1 = str(msgid1, self._charset)
328328
tmsg = [str(x, self._charset) for x in tmsg]

0 commit comments

Comments
 (0)