summaryrefslogtreecommitdiffstats
path: root/Lib/gettext.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-08-29 03:08:55 (GMT)
committerGuido van Rossum <guido@python.org>2007-08-29 03:08:55 (GMT)
commit9600f93db6038ef6d5a1254295bac61e96fa56a2 (patch)
tree52836ff77e2b3e6c2fcac1225bebe0646d63d81a /Lib/gettext.py
parent83800a657863575387f04dcfee36b53f6af1a310 (diff)
downloadcpython-9600f93db6038ef6d5a1254295bac61e96fa56a2.zip
cpython-9600f93db6038ef6d5a1254295bac61e96fa56a2.tar.gz
cpython-9600f93db6038ef6d5a1254295bac61e96fa56a2.tar.bz2
Make gettext work with strict str/bytes.
Diffstat (limited to 'Lib/gettext.py')
-rw-r--r--Lib/gettext.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/gettext.py b/Lib/gettext.py
index d3f8538..37ebf8a 100644
--- a/Lib/gettext.py
+++ b/Lib/gettext.py
@@ -292,7 +292,7 @@ class GNUTranslations(NullTranslations):
if mlen == 0:
# Catalog description
lastk = k = None
- for b_item in tmsg.split(os.linesep):
+ for b_item in tmsg.split(os.linesep.encode("ascii")):
item = str(b_item).strip()
if not item:
continue
@@ -321,8 +321,8 @@ class GNUTranslations(NullTranslations):
# if the Unicode conversion fails.
if b'\x00' in msg:
# Plural forms
- msgid1, msgid2 = msg.split('\x00')
- tmsg = tmsg.split('\x00')
+ msgid1, msgid2 = msg.split(b'\x00')
+ tmsg = tmsg.split(b'\x00')
if self._charset:
msgid1 = str(msgid1, self._charset)
tmsg = [str(x, self._charset) for x in tmsg]