From: Armin Ronacher Date: Sat, 6 Jul 2013 16:20:06 +0000 (+0200) Subject: Fixed a regression in the pluralization support X-Git-Tag: 1.0~86 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b91f410bae91a66b8a8dbf925478c715843bc889;p=thirdparty%2Fbabel.git Fixed a regression in the pluralization support --- diff --git a/babel/plural.py b/babel/plural.py index 6e3d274d..c3137dbf 100644 --- a/babel/plural.py +++ b/babel/plural.py @@ -166,7 +166,9 @@ def to_python(rule): to_python = _PythonCompiler().compile result = ['def evaluate(n):'] for tag, ast in PluralRule.parse(rule).abstract: - result.append(' if (%s): return %r' % (to_python(ast), tag)) + # the str() call is to coerce the tag to the native string. It's + # a limited ascii restricted set of tags anyways so that is fine. + result.append(' if (%s): return %r' % (to_python(ast), str(tag))) result.append(' return %r' % _fallback_tag) code = compile('\n'.join(result), '', 'exec') eval(code, namespace)