mirror of https://github.com/python/cpython.git
GNUTranslations._parse(): Fix SF bug #658233, where continuation lines
in .po metadata caused a crash. Backport candidate.
This commit is contained in:
parent
15eac1f95c
commit
7de63f57c8
|
@ -261,14 +261,19 @@ def _parse(self, fp):
|
||||||
# See if we're looking at GNU .mo conventions for metadata
|
# See if we're looking at GNU .mo conventions for metadata
|
||||||
if mlen == 0:
|
if mlen == 0:
|
||||||
# Catalog description
|
# Catalog description
|
||||||
|
lastk = None
|
||||||
for item in tmsg.splitlines():
|
for item in tmsg.splitlines():
|
||||||
item = item.strip()
|
item = item.strip()
|
||||||
if not item:
|
if not item:
|
||||||
continue
|
continue
|
||||||
|
if ':' in item:
|
||||||
k, v = item.split(':', 1)
|
k, v = item.split(':', 1)
|
||||||
k = k.strip().lower()
|
k = k.strip().lower()
|
||||||
v = v.strip()
|
v = v.strip()
|
||||||
self._info[k] = v
|
self._info[k] = v
|
||||||
|
lastk = k
|
||||||
|
elif lastk:
|
||||||
|
self._info[lastk] += '\n' + item
|
||||||
if k == 'content-type':
|
if k == 'content-type':
|
||||||
self._charset = v.split('charset=')[1]
|
self._charset = v.split('charset=')[1]
|
||||||
elif k == 'plural-forms':
|
elif k == 'plural-forms':
|
||||||
|
|
Loading…
Reference in New Issue