From 7de63f57c881cb94ba89c2a1dfaf79af1bba52bb Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Tue, 20 May 2003 17:26:48 +0000 Subject: [PATCH] GNUTranslations._parse(): Fix SF bug #658233, where continuation lines in .po metadata caused a crash. Backport candidate. --- Lib/gettext.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Lib/gettext.py b/Lib/gettext.py index bc6779f3d8..6c8a7df76d 100644 --- a/Lib/gettext.py +++ b/Lib/gettext.py @@ -261,14 +261,19 @@ class GNUTranslations(NullTranslations): # See if we're looking at GNU .mo conventions for metadata if mlen == 0: # Catalog description + lastk = None for item in tmsg.splitlines(): item = item.strip() if not item: continue - k, v = item.split(':', 1) - k = k.strip().lower() - v = v.strip() - self._info[k] = v + if ':' in item: + k, v = item.split(':', 1) + k = k.strip().lower() + v = v.strip() + self._info[k] = v + lastk = k + elif lastk: + self._info[lastk] += '\n' + item if k == 'content-type': self._charset = v.split('charset=')[1] elif k == 'plural-forms': -- 2.50.1