From 071e38a1c9d882e3290430255a5a707d3d9aa8e0 Mon Sep 17 00:00:00 2001 From: benselme Date: Fri, 9 Jan 2015 11:17:07 -0500 Subject: [PATCH] Fix to_python when i is not provided to evaluate function --- babel/plural.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/babel/plural.py b/babel/plural.py index b11b17e5..7ce62e1f 100644 --- a/babel/plural.py +++ b/babel/plural.py @@ -184,8 +184,8 @@ def to_python(rule): } to_python_func = _PythonCompiler().compile result = [ - 'def evaluate(n, v=0, w=0, f=0, t=0):', - ' i = int(n)', + 'def evaluate(n, i=None, v=0, w=0, f=0, t=0):', + ' i = int(n) if i is None else i', ] for tag, ast in PluralRule.parse(rule).abstract: # the str() call is to coerce the tag to the native string. It's -- 2.47.2