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

Skip to content

Commit 7de63f5

Browse files
committed
GNUTranslations._parse(): Fix SF bug #658233, where continuation lines
in .po metadata caused a crash. Backport candidate.
1 parent 15eac1f commit 7de63f5

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

Lib/gettext.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,19 @@ def _parse(self, fp):
261261
# See if we're looking at GNU .mo conventions for metadata
262262
if mlen == 0:
263263
# Catalog description
264+
lastk = None
264265
for item in tmsg.splitlines():
265266
item = item.strip()
266267
if not item:
267268
continue
268-
k, v = item.split(':', 1)
269-
k = k.strip().lower()
270-
v = v.strip()
271-
self._info[k] = v
269+
if ':' in item:
270+
k, v = item.split(':', 1)
271+
k = k.strip().lower()
272+
v = v.strip()
273+
self._info[k] = v
274+
lastk = k
275+
elif lastk:
276+
self._info[lastk] += '\n' + item
272277
if k == 'content-type':
273278
self._charset = v.split('charset=')[1]
274279
elif k == 'plural-forms':

0 commit comments

Comments
 (0)