homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dsegan
Recipients
Date 2006年03月11日.23:20:02
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
See http://bugzilla.gnome.org/show_bug.cgi?id=334256
The problem is a PO file like the following:
test.po:
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"#-#-#-#-# plo.po (PACKAGE VERSION) #-#-#-#-#\n"
(these kinds of entries are sometimes inserted by
msgmerge, so they're somewhat common)
Any Python program trying to access this breaks:
$ python test.py
Traceback (most recent call last):
 File "test.py", line 7, in ?
 gt = gettext.GNUTranslations(file)
 File "/usr/lib/python2.4/gettext.py", line 177, in
__init__
 self._parse(fp)
 File "/usr/lib/python2.4/gettext.py", line 300, in _parse
 v = v.split(';')
AttributeError: 'list' object has no attribute 'split'
test.py is simple:
#!/usr/bin/env python
import gettext
file = open("test.mo", "rb")
if file:
 gt = gettext.GNUTranslations(file)
The problem is the corner-case: plural-forms precedes
this kind of comment, so "v" is split (v=v.split(";")).
In the next instance, lastk is "plural-forms", yet the
entry doesn't contain ":", so it tries to set plural
forms to v.split(";") again, which fails since v is
already a list.
The attached simple patch fixes this.
History
Date User Action Args
2007年08月23日 14:38:26adminlinkissue1448060 messages
2007年08月23日 14:38:26admincreate

AltStyle によって変換されたページ (->オリジナル) /