diff options
author | Andrew Kuchling <amk@amk.ca> | 2015-04-13 10:38:56 -0400 |
---|---|---|
committer | Andrew Kuchling <amk@amk.ca> | 2015-04-13 10:38:56 -0400 |
commit | ec6bcce3305d6c82c9cdb02ea7013849061c3625 (patch) | |
tree | 6a27fe83fde17cf96585e1741c6d0f5be71022fd /Lib/test/test_gettext.py | |
parent | d072050a7ae31a363dec3eb4357305f3f17ddb55 (diff) | |
download | cpython-ec6bcce3305d6c82c9cdb02ea7013849061c3625.tar.gz |
#17898: reset k and v so that the loop doesn't use an old value
Diffstat (limited to 'Lib/test/test_gettext.py')
-rw-r--r-- | Lib/test/test_gettext.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Lib/test/test_gettext.py b/Lib/test/test_gettext.py index abb312f060..2737e81367 100644 --- a/Lib/test/test_gettext.py +++ b/Lib/test/test_gettext.py @@ -79,6 +79,12 @@ class GettextBaseTest(unittest.TestCase): del self.env support.rmtree(os.path.split(LOCALEDIR)[0]) +GNU_MO_DATA_ISSUE_17898 = b'''\ +3hIElQAAAAABAAAAHAAAACQAAAAAAAAAAAAAAAAAAAAsAAAAggAAAC0AAAAAUGx1cmFsLUZvcm1z +OiBucGx1cmFscz0yOyBwbHVyYWw9KG4gIT0gMSk7CiMtIy0jLSMtIyAgbWVzc2FnZXMucG8gKEVk +WCBTdHVkaW8pICAjLSMtIy0jLSMKQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PVVU +Ri04CgA= +''' class GettextTestCase1(GettextBaseTest): def setUp(self): @@ -290,6 +296,14 @@ class PluralFormsTestCase(GettextBaseTest): # Test for a dangerous expression raises(ValueError, gettext.c2py, "os.chmod('/etc/passwd',0777)") +class GNUTranslationParsingTest(GettextBaseTest): + def test_plural_form_error_issue17898(self): + with open(MOFILE, 'wb') as fp: + fp.write(base64.decodebytes(GNU_MO_DATA_ISSUE_17898)) + with open(MOFILE, 'rb') as fp: + # If this runs cleanly, the bug is fixed. + t = gettext.GNUTranslations(fp) + class UnicodeTranslationsTest(GettextBaseTest): def setUp(self): @@ -465,3 +479,16 @@ msgstr "" "Content-Transfer-Encoding: quoted-printable\n" "Generated-By: pygettext.py 1.3\n" ''' + +# +# messages.po, used for bug 17898 +# + +''' +# test file for http://bugs.python.org/issue17898 +msgid "" +msgstr "" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"#-#-#-#-# messages.po (EdX Studio) #-#-#-#-#\n" +"Content-Type: text/plain; charset=UTF-8\n" +''' |